getattr() woes

Kamilche kamilche at mad.scientist.com
Fri Dec 31 02:26:20 CET 2004


Thomas Rast wrote:
> I've found out about a fundamental problem of attribute lookup, the
> hard way...  Is there anything that can be done about this?

It seems to me that the main problem is you're raising an AttributeError 
when an attribute is private. AttributeError is only raised when an 
attribute is not found. If you found it, but it's private, that's a 
different problem. Try raising a custom exception instead of an 
AttributeError, if you can.






More information about the Python-list mailing list