[Tutor] Calling super classs __init__?

Andreas Kostyrka andreas at kostyrka.org
Fri Mar 21 03:34:29 CET 2008


Am Freitag, den 21.03.2008, 21:48 -0500 schrieb tiger12506:

Actually, super returns all base classes, all in it's own time.

Basically, every class has a member __mro__, that contains a
consistently ordered list of classes.

super needs the class from where it is being called to locate the right
place in the __mro__ and to hand you a wrapper around self for the next
base class in this list.

This way, if all classes use super, they can cooperativly call all
implementations of a given method.

That's the theory. In practice there are a number of pitfalls which
makes super problematic. ;)

Andreas

> Also, does anyone want to clarify? I thought that super() only return one of 
> the base classes and was frowned upon for objects using multiple 
> inheritance??? 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://mail.python.org/pipermail/tutor/attachments/20080321/dffca54d/attachment.pgp 


More information about the Tutor mailing list