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

Hrvoje Niksic hniksic at xemacs.org
Fri Jul 30 08:38:32 EDT 2010


Gregory Ewing <greg.ewing at canterbury.ac.nz> writes:

> I think the point is that the name is misleading, because it makes it
> *sound* like it's going to call a method in a superclass, when it fact
> it might not.

That is indeed confusing to some people, especially those who refuse to
to accept the notion that "superclass" means the same as "next in MRO",
maintaining instead that superclass refers to one of the base classes,
their bases, etc. -- IMO a defensible position.

super might have better been called next_in_mro, next_method, or
next_class, except those are harder to type, and way less catchy than
"super".  The Dylan and CLOS operator that super is most closely based
on is called (call-)next-method.



More information about the Python-list mailing list