Tuesday, February 08, 2022

Friendly-traceback and IPython: update

In my previous post, I mentioned that, unlike IPython, friendly/friendly-traceback included values of relevant objects in a traceback.  As I wrote in the update, Alex Hall pointed out that one could get this information by using a verbose mode in IPython.  Here is the previous example when using the verbose mode.



In (1) I enabled the verbose mode. In (3), we see its effect.   (2) is a reminder of the highlighting when it spans many lines.  Regarding the highlighting, here's what I had in the previous blog post:


Alex Hall (yes, him again), the author of stack_data used by both IPython and friendly-traceback, suggested that perhaps a better way would be to have a common indentation. This is what I implemented next:



In my code, this is done in a rather convoluted way. Following a suggestion by Alex, I implemented a change in stack_data itself which yields the correct result, at least when using carets (^) as marker for the location.  If Alex can confirm that it works for stack_data in all cases, this new way of highlighting consecutive lines would likely be automatically incorporated into IPython.

The reason I go into all these datails is as follows: I'm really interested in getting feedback from users so as to make friendly/friendly-traceback even more useful.  So, don't be shy! :-)


No comments:

Post a Comment

Spammers: none shall pass.

Note: Only a member of this blog may post a comment.