[Python-Dev] less quick patch for better debugging.

Hunter Peress hunterp at fastmail.fm
Wed Nov 26 01:44:16 EST 2003


Ah. Theres clearly interest in the idea. I guess its as simple as adding
a field to Py_Object that would record the last namespace name used for a
given object (remember any object could have many names...) (not sure
about Threads btw here).

This would allow for all error lookup-type error messages to be much
cleaner.

The impetus for the above idea being an index error on the following
line:

a[1] +  b[2] + c[3]...currently gives an error message that doesnt say
which variable the list index error occurs in or at which index it occurs
at (helpful if they were all the same object on the same line). Same
issues go for dicts and even any object attributes as well.

PS. maybe in the interest of runtime speed, the assigning to this new
field could only occur when there actually is an error.



More information about the Python-Dev mailing list