Erm... might I suggest... (Re: New PEP: Attribute Access Handlers)

Greg Ewing to_get_my_address at see.my.signature
Wed Jul 26 21:17:20 EDT 2000


Paul Prescod wrote:
> 
> If I understand this correctly, then the very first time you add the
> attribute to the dict you effectively wipe out the accessor because the
> test above will evaluate true every time and the branch that uses
> accessors will never get called.

Well, that's the same as the way __getattr__ works now,
since it's only called if normal attribute lookup fails.

If it's considered the wrong behaviour, I wouldn't object
to modifying it as Ben Wolfson suggests, so that a check
for __get_XXX__ is made before the direct attribute access.

-- 
Greg Ewing, Computer Science Department, 
University of Canterbury, New Zealand
To get my email address, please visit my web page:
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list