Extending classes __init__behavior for newbies

Mauro Caceres mauro.caceres at gmail.com
Mon Feb 14 17:18:33 CET 2011

> Where is the buggy code? Show me how Ship.__init__() can break. Anyone
> can argue, few can offer facts. If you bring an argument that
> Ship.__init__() can break if someone changes the code then that IS NOT
> an valid argument. ANY code can be broken with the addition or
> subtraction of a single char.
The idea of using super() is that it works with single inheritance and
multiple inheritance.
If after a while your FasterShip extends from Ship and Bird, your
Ship.__init__() will still work BUT it may not be calling the right code. So
using super() is less error prone.

The official documentation also recommends to use super()


Mauro Cáceres
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110214/fd841abc/attachment.html>

More information about the Python-list mailing list