16
General Discussion / Re: if self.isCoder(): post() #Programming Thread
« on: November 06, 2012, 11:06:28 am »
This works also, just make the "param" optional parameter.
The "param=None" means that you don't have to give that argument. If you don't give it, it will be None and the Player.update calls Animation.update.
Code: [Select]
class Animate:
def update(self):
print 'Animate update'
class Player(Animate):
def update(self, param=None):
if param:
print 'Player update with parameter',param
else:
Animate.update(self)
player = Player()
player.update() # Prints Animate update
player.update(1234) # Prints Player update with parameter 1234
The "param=None" means that you don't have to give that argument. If you don't give it, it will be None and the Player.update calls Animation.update.



