What are super()'s semantics?

Michele Simionato michele.simionato at gmail.com
Mon Sep 4 13:07:31 CEST 2006


Mike Krell wrote:
> BTW, the official docs are even worse in this regard.  AFAICT, they
> essentially say that super() returns a superclass with no discussion of
> diamond inheritance or any hint of how the semantics of super(B,
> self).met() would be any different than those of A.met(self).
>
> This seems like very important functionality to be documented in the
> official docs so poorly.

Well, you are right. I remember being fooled myself. 'super' does NOT
return a
superclass. Actually, there is no meaningful concept of superclass in a
multiple inheritance
world. Anyway, the MRO concept is documented here:

http://www.python.org/download/releases/2.3/mro/

(yes, it is not easy to find this link in python.org).

                Michele Simionato




More information about the Python-list mailing list