Class/type unification and reference to unbound methods
Thomas Heller
thomas.heller at ion-tof.com
Fri May 11 08:51:28 EDT 2001
[...]
> class A:
> def spam(self):
> ...
>
> class B(A):
> def spam(self):
> ...
>
> class C(A):
> def spam(self):
> ...
>
> class D(B, C):
> spam = C.spam
>
> This is akin to feature renaming as supported by Eiffel and comes in
> handy when one class is found in the inheritance chain repeatedly.
> Such renaming also is useful with extensive use of mixins.
IMO the above would continue to work even if C.spam would be a function
instead of a bound method. Today it would look like this:
class D(B, C):
spam = C.spam.im_func
(Although the above looks somewhat strange to me...)
Thomas
More information about the Python-list
mailing list