maximum recursion depth is reducing?
Xiao-Qin Xia
xx758 at cam.ac.uk
Tue Feb 25 13:18:32 EST 2003
Dear Steven Taschuk,
> __getattr__(self, name)
> Called when an attribute lookup has not found the attribute in the
> usual places (i.e. it is not an instance attribute nor is it found
> in the class tree for self). [...]
>
> So if self.text_widget has been bound, a reference to it will be
> resolved normally, and __getattr__ will not be called.
I hope so, but it doesn't seem to be the truth. In the codes I presented,
self.text_widget should be created at the same time when the instace is
created. But obviously __getattr__ will be called if __init__ calls Text to
create self.text_widget, instead of create it by itself.
This problem make it to be dangerous to override __getattr__.
Regards,
Xiao-Qin
More information about the Python-list
mailing list