multiple inheritance
newseater
kbilsted at hotmail.com
Thu Jun 9 06:28:13 EDT 2005
how nice! is this due to a linearization taking place of A and B when
compiling C ? is this a 'feature' of the language or its actual
semantics to behave like this?
> class IFoo(object):
> def foo(self):
> pass
>
> class A(IFoo):
> def foo(self):
> print "a"
> super(A,self).foo()
>
> class B(IFoo):
> def foo(self):
> print "b"
> super(B,self).foo()
>
> class C(A,B):
> def foo(self):
> print "c"
> super(C,self).foo()
>
> >>> C().foo()
> c
> a
> b
More information about the Python-list
mailing list