James Mills <prolo...@shortcircuit.net.au> writes: > On Mon, Feb 14, 2011 at 8:21 AM, MRAB <pyt...@mrabarnett.plus.com> wrote: > > I would've done it this way: > > > > class FasterShip(Ship): > > def __init__(self, speed=0, **kwargs): > > Ship.__init__(self, **kwargs) > > self.speed = speed > > What's the difference between calling the base > class's constructor directly and using the super type ?
The difference arises in multiple inheritance. Your class can never know whether it is used as part of a multiple-inheritance hierarchy, in which case calling the base class directly would be the wrong thing to do since that might not match the MRO. However, using ‘__super__’ properly is very problematic. A case can be made that it's an inherent problem of multiple inheritance, which should therefore be avoided. Search the archives of this forum to learn more. -- \ “If you don't know what your program is supposed to do, you'd | `\ better not start writing it.” —Edsger W. Dijkstra | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list