[Python-Dev] Traceback style
Guido van Rossum
guido@python.org
Tue, 02 May 2000 08:22:24 -0400
> > Ka-Ping Yee <ping@lfw.org>:
> > > With the suggested changes, this would print as
> > >
> > > Traceback (innermost last):
> > > Line 1 of <stdin>
> > > Line 3 of <stdin>, in Spam.eggs
> > > AttributeError: ham
ESR:
> > IMHO, this is not a good idea. Emacs users like me want traceback
> > labels to be *more* like C compiler error messages, not less.
Ping:
> I suppose Python could go all the way and say things like
>
> Traceback (innermost last):
> <stdin>:3
> foo.py:25: in Spam.eggs
> AttributeError: ham
>
> but that might be more intimidating for a beginner.
>
> Besides, you Emacs guys have plenty of programmability anyway :)
> You would have to do a little parsing to get the file name and
> line number from the current format; it's no more work to get
> it from the suggested format.
Not sure -- I think I carefully designed the old format to be one of
the formats that Emacs parses *by default*: File "...", line ... Your
change breaks this.
> (What i would really like, by the way, is to see the values of
> the function arguments on the stack -- but that's a lot of work
> to do in C, so implementing this with the help of repr.repr
> will probably be the first thing i do with sys.displaytb.)
Yes, this is much easier in Python. Watch out for values that are
uncomfortably big or recursive or that cause additional exceptions on
displaying.
--Guido van Rossum (home page: http://www.python.org/~guido/)