getattr() woes

Nicolas Fleury nid_oizo at yahoo.com_removethe_
Wed Dec 29 18:55:24 EST 2004


David M. Cooke wrote:
> Ideally, I think the better way is if getattr, when raising
> AttributeError, somehow reused the old traceback (which would point
> out the original problem). I don't know how to do that, though.

Maybe a solution could be to put the attribute name in the 
AttributeError exception object, and use it in getattr; if the name 
doesn't match, the exception is re-raised.  It's still not flawless, but 
would reduce risk of errors.

Nicolas



More information about the Python-list mailing list