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

Gregory Ewing greg.ewing at canterbury.ac.nz
Fri Jul 30 03:35:52 EDT 2010


Steven D'Aprano wrote:

> 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.

That's not strictly true. It will call a method belonging to some
class in the mro of self, but that class is not necessarily in
the base list of the class mentioned in the super() call. It's
possible for a super() call to go "sideways" in the inheritance
graph.

-- 
Greg



More information about the Python-list mailing list