super() doesn't get superclass

Alex Martelli aleax at mac.com
Tue Sep 18 01:31:40 EDT 2007


Ben Finney <bignose+hates-spam at benfinney.id.au> wrote:

> Am I mistaken in thinking that "superclass of foo" is equivalent to
> "parent class of foo"? If so, I'd lay heavy odds that I'm not alone in
> that thinking.

"That thinking" (confusing "parent" with "ancestor") makes sense only
(if at all) in a single-inheritance world.  Python's super() exists to
support MULTIPLE inheritance.

In general, "a superclass of foo" means "a class X such that foo is a
sublass of X" and thus applies to all parents, all parents of parents,
and so on ("issubclass" does NOT mean "is a DIRECT AND IMMEDIATE
subclass", but "is a subclass"; check the Python builtin function of
that name).


Alex



More information about the Python-list mailing list