Extending classes __init__behavior for newbies
rantingrick
rantingrick at gmail.com
Sun Feb 13 17:39:45 EST 2011
More information about the Python-list mailing list
Sun Feb 13 17:39:45 EST 2011
- Previous message (by thread): Extending classes __init__behavior for newbies
- Next message (by thread): Extending classes __init__behavior for newbies
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message (by thread): Extending classes __init__behavior for newbies
- Next message (by thread): Extending classes __init__behavior for newbies
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list