__getattr__ and other customization methods
Brian Quinlan
brian at sweetapp.com
Sun Jun 17 16:52:57 EDT 2001
Is there any reason why getattr, when called on an instance, should call
that instance's __getattr__ method for other customization methods
(methods starting with __)?
I ask because there are clear advantages in not doing so i.e it prevents
potential infinite loop problems when used for proxying, potential
problems with the return type of __repr__, etc [1].
I would imagine that there isn't a lot of code out there that depends on
receiving __getattr__ calls for customization methods. And there is a
lot of code that has to specifically defend against it. So what do you
think? Time for a PEP?
[1] As a concrete example, both of these problems occur when doing a
dir() or print on a PyXSL SOAPProxy instance (I'll submit the fix
later).
More information about the Python-list
mailing list