[Python-ideas] Verbose traceback formatting

Mike Graham mikegraham at gmail.com
Sat Sep 1 02:35:56 CEST 2012


On Wed, Aug 29, 2012 at 5:24 PM, Terry Reedy <tjreedy at udel.edu> wrote:
> Part of the problem is in the overly skimpy exception instances
> themselves. They should contain the needed runtime info that one
> cannot find in the code. I would rather you push for more such
> changes.
>
>>> ...
>>>          x = 16
>>>          y = 0
>>> ...
>
>>>ZeroDivisionError: integer division or modulo by zero
>
> This could and, imo, should be changed to include the numerator,
> which is the main extra info included the the verbose traceback.
> Most of the rest strikes me as noise.

I think you have read the example too narrowly. Having the locals of
each frame is _very_ useful--just because I know the terms of the
division does not mean that I can easily connect that information back
five calls ago when I passed the wrong thing. Currently you have to
spin up the debugger (or insert print statements or similar) to get
this information, which is more work than it is to read it and
requires another run of your code (and getting to the same point could
be expensive or tricky).

Mike



More information about the Python-ideas mailing list