Re: getattr
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Re: getattr

From: Fredrik Lundh <fredrik@pythonware.com>
Date: Fri Sep 30 2005 - 18:21:12 CEST

kyaBey@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>
Received on Sat Oct 15 04:00:33 2005