[Patches] Patch: AttributeError and NameError: second attempt.

Nick Mathewson nickm@MIT.EDU
Fri, 26 May 2000 09:27:43 -0400


Guido van Rossum <guido@python.org> wrote:
 [...]
>Sorry for the barrage of messages showing me thinking aloud.  I'm
>beginning to realize what makes me feel uneasy with Nick's approach.
>This kind of user-friendliness should really be in the tools, not in
>the core language implementation!  And the friendliness should only be
>paid for when a traceback is printed.
>
>For example, IDLE prints its own traceback.  It has the stack frame
>available too (via sys.exc_traceback).  It could easily detect a
>NameError or AttributeError and do the various checks for misspelled
>identifiers.  This is where it should be fixed.  (In fact, it should
>be made available in general e.g. through the traceback module so it
>can also be added to other IDEs like Pythonwin or ActivePython.)

Hm.... through the traceback module.  Ok, that makes sense.  In fact,
it's a great idea.  We could work through an improved print_exception
or something; is that what you had in mind?  Would that kind of
approach be acceptable?

My other question is: It wouldn't be that hard to do the improved
NameError stuff through a traceback, but can I do name-correction on
AttributeError?  I'd need a pointer back to the object/module/whatever
that raised the error, and I don't think I can get one just from
the traceback.

BTW, I've been trying to get this done fast under the assumption that it had
a chance for 1.6.  Does it?
-- 
Nick