[Python-3000] Give power to __getattr__

Kay Schluehr kayschluehr at gmx.de
Tue Apr 25 07:20:13 CEST 2006


While observing heated discussions about adaption and generic functions 
I wonder if this
is a good opportunity for a modest complaint about the castration of 
__getattr__ in new style classes.
What are you doing if you want to adapt a new style class X to a class 
that has implemented
e.g. __add__ or any other special function, you might not yet know? You 
can't simply delegate the call
to the wrapper but you have to implement __add__ in X by hand and then 
delegate ( or create it explicitely
using the metaclass protocol but that's less flexible and if the target 
class of your adaption is changed at
runtime you get lost ) otherwise you keep a type-error. Special methods 
become very special so to say.
I would like to ask for a little un-specialization of special methods in 
this respect and making the language
a little more symmetric.





More information about the Python-3000 mailing list