[Python-Dev] Python 2.2a* getattr suggestion and question (original) (raw)

Jeff Epler jepler@inetnebr.com
Mon, 1 Oct 2001 09:00:29 -0500


On Sun, Sep 30, 2001 at 02:37:00PM -0400, Guido van Rossum wrote:

> Sure. Still, I think interpreter diagnostics should be pointing to the > exact place of trouble. At least, getattribute must appear somewhere > in the traceback to give a hint where from repr was attempted to be > called.

When you write a faulty getattribute that returns None instead of raising AttributeError, it's not realistic to expect getattribute to be in the stack trace.

PyChecker might want to give an error if flow in getattr[ibute] doesn't either pass through a return or a 'raise AttributeError'. Even if the intent is to have attributes default to None, an explicit 'return None' could be added.

Jeff