super

TheDoctor dreamingforward at gmail.com
Mon Jun 1 16:38:57 EDT 2015


Missive #02441:  super()

If you're going to use object composition, creating a super (no pun intended) class, you are forming an explicit object hierarchy (unlike mix-in style).  In this case, if the method exists in the parent class, you shouldn't give the user (or subclass) the choice of calling super because it will break the concept of PARENT.

The other VERY GOOD reason is that there's no question about initialization order.  A subclass can sometimes call other methods.  If those methods also are in the super class you have condition where you can't quite tell what is happening where.  When the hierarchy of calls is well-defined because you can rely on super call order, then there's *no problem*.

Please direct questions to my hand.

Mark



More information about the Python-list mailing list