invoking a method from two superclasses

Carl Banks pavlovevidence at gmail.com
Wed Jul 1 01:37:19 EDT 2009


On Jun 30, 9:15 pm, "Gabriel Genellina" <gagsl-... at yahoo.com.ar>
wrote:
> En Tue, 30 Jun 2009 21:34:02 -0300, Mitchell L Model  
> <MLMLi... at comcast.net> escribi :
>
> > Allow me to add to my previous question that certainly the superclass
> > methods can be called explicitly without resorting to super(), e.g.:
>
> >     class C(A, B):
> >         def __init__(self):
> >             A.__init__(self)
> >             B.__init__(self)
>
> > My question is really whether there is any way of getting around the
> > explicit class names by using super() and if not, shouldn't the  
> > documentation
> > of super point out that if more than one class on the mro defines a  
> > method
> > only the first will get called?
>
> super returns [a proxy to] the *next* class in the MRO chain; it may or  
> may not be a superclass of C (it may be a sibling class instead).

It could be even a niece class.


Carl Banks



More information about the Python-list mailing list