super() and multiple inheritance failure

Steven D'Aprano steve at
Sat Sep 26 06:48:08 CEST 2009

On Fri, 25 Sep 2009 21:03:09 -0700, Michele Simionato wrote:

> On Sep 26, 4:36 am, Steven D'Aprano <st... at REMOVE-THIS-
>> wrote:
>> I don't understand why I'm getting the following behaviour when using
>> super() with multiple inheritance.
> super is working as intended. If you do not want cooperative methods,
> don't use super and call directly the superclass. 


Is there a standard name for what I'm trying to do, versus what super() 
does? I assume the term for what super() does is "cooperative multiple 
inheritance". What should I call what I'm doing? "Non-cooperative MI" 

> I usually recommend avoiding multiple inheritance altogether.

In my case, PClass and NClass are actually private classes, and it seemed 
like a nice way to avoid having to fill MyClass with slightly-different 
versions of each method to deal with slight variations in the arguments. 
I'm aiming for some sort of polymorphic inheritance: in a method, if the 
argument meets some condition, inherit from PClass, if it meets another 
condition inherit from NClass, and so on. Is there are standard name for 
this idea?

> You may want to read "Things to know about super":

Nice, thank you. It will take me a while to digest all that, this is my 
first attempt at deliberate multiple inheritance, and obviously my 
expectations were completely different.


More information about the Python-list mailing list