[Python-Dev] Traceback style

Greg Ward gward@mems-exchange.org
Tue, 2 May 2000 08:27:51 -0400


On 02 May 2000, Ka-Ping Yee said:
> I propose the following stylistic changes to traceback
> printing:
> 
>     1.  If there is no function name for a given level
>         in the traceback, just omit the ", in ?" at the
>         end of the line.

+0 on this: it doesn't really add anything, but it does neaten things
up.

>     2.  If a given level of the traceback is in a method,
>         instead of just printing the method name, print
>         the class and the method name.

+1 here too: this definitely adds utility.

>     3.  Instead of beginning each line with:
>         
>             File "foo.py", line 5
> 
>         print the line first and drop the quotes:
> 
>             Line 5 of foo.py

-0: adds nothing, cleans nothing up, and just generally breaks things
for no good reason.

>         In the common interactive case that the file
>         is a typed-in string, the current printout is
>         
>             File "<stdin>", line 1
>         
>         and the following is easier to read in my opinion:
> 
>             Line 1 of <stdin>

OK, that's a good reason.  Maybe you could special-case the "<stdin>"
case?  How about

   <stdin>, line 1

?

        Greg