Extending classes __init__behavior for newbies
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
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()
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list