derived classes and __getattr__
Bruno Desthuilliers
bruno.42.desthuilliers at websiteburo.invalid
Fri Sep 5 09:09:31 EDT 2008
Alexandru Mosoi a écrit :
(snip)
> 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