Extending classes __init__behavior for newbies

rantingrick rantingrick at gmail.com
Sun Feb 13 17:39:45 EST 2011


On Feb 13, 4:00 pm, James Mills <prolo... at shortcircuit.net.au> wrote:

> class FasterShip(Ship):
>
>     def __init__(self, l=0,b=0,t=0,name='', speed=0):
>         super(FasterShip, self).__init__(l, b, t, name)
>
>         self.speed = speed

Did everyone miss the fact that this inheritance is unnecessary?
Considering the Ship class has an attribute "speed" that will be
affected (either directly or indirectly) by simply modifying it?

faster_ship = Ship()
faster_ship.speed = someFasterSpeed




More information about the Python-list mailing list