derived classes and __getattr__

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Fri Sep 5 15:09:31 CEST 2008

Alexandru Mosoi a écrit :
> i somehow fixed the problem using:
>   def __getattr__(self, attr):
>         return
> functools.partial(Base.__metaclass__.__getattr__(self.__class__,
> attr), self)
> however this looks ugly enough to look for another solution. i still
> have one more question: why do I have to bind self? (without which
> functions fail expecting an instance)

Because the partial type doesn't implement the descriptor protocol 
(which is implemented by function type to return a method).

More information about the Python-list mailing list