Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

Jean-Michel Pichavant jeanmichel at sequans.com
Thu Jul 29 13:29:24 EDT 2010


Steven D'Aprano wrote:
> [snip]
>
> super() is just as explicit as len(), or str.upper(). It says, 
> explicitly, that it will call the method belonging to one or more 
> superclass of the given class.
>   
Come on Steven, you're better than this :) .
Everybody can accurately guess what len and upper are doing without 
looking at the documentation. No one can guess for super without closely 
looking at the documention, or even at some good articles on the net 
which try to clear things up about super. And note there is no such 
article about len or upper.

As someone already said in this list, the main problem with super is 
that it tends to refer to the superclass method while in fact it calls 
the next MRO method.

"mro" would have been the proper name for "super".

JM




More information about the Python-list mailing list