getattr

Fredrik Lundh fredrik at pythonware.com
Fri Sep 30 12:21:12 EDT 2005


kyaBey at gmail.com wrote:

> Is there any  way by which the __getattr__(self,attr) method can
> determine that in
> case a) attr == 'bar' is the final component in the reference unlike in
> case b) where attr=='bar' is NOT the ultimate(final) component of
> reference and is an intermediate component in the reference.

no.

if you want to control further accesses, your __getattr__ has to return a
proxy object, and use a suitable syntax to get the final value.

</F> 






More information about the Python-list mailing list