[Python-talk] can't make meeting
Lloyd Kvam
python at venix.com
Thu May 22 17:12:53 EDT 2008
I do have a gotcha to mention:
I have some old python code that used __getattr__ to handle things like
delegating attribute lookup to a component and computing answers for
"synthetic" attributes.
I used properties to add a new computed property and it just did not
work. Then I realized that I really could not mix __getattr__ based
logic with properties.
__getattr__ operates against the instance __dict__ and gets control when
an attribute reference is not in __dict__. Properties are handled
through the class __dict__. So a reference to an attribute provided by
properties will first trigger the __getattr__ logic. I removed the
properties and put the processing logic into my __getattr__ handling.
--
Lloyd Kvam
Venix Corp
DLSLUG/GNHLUG library
http://www.librarything.com/catalog/dlslug
http://www.librarything.com/profile/dlslug
http://www.librarything.com/rsshtml/recent/dlslug
More information about the Python-talk
mailing list