[Python-Dev] Attribute lookup ambiguity

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Mar 23 23:47:00 CET 2010


Pascal Chambon wrote:

> All I've found is "If the class also defines __getattr__(), 
> the latter will not be called unless __getattribute__()
> either calls it explicitly or raises an AttributeError

Hmmm. Well, it still implies that there is some mechanism
outside of __getattribute__ that will catch an AttributeError
and call __getattr__ for you. Given the existence of that
mechanism, it seems unlikely that the same thing would be
implemented over again in the standard __getattribute__
method.

So I don't think it requires very much guesswork to infer
that the standard __getattribute__ won't call __getattr__ on
its own.

I concede that the wording could be improved to remove any
possibility of doubt, though.

-- 
Greg


More information about the Python-Dev mailing list