alternative: the super function. : super « Class « Python Tutorial






class Bird(object):
    def __init__(self):
       self.hungry = 1
    def eat(self):
       if self.hungry == 1: 
          print 'hungry...'
          self.hungry = 0
       else: 
          print 'No, thanks!'

class SongBird(Bird):
    def __init__(self):
        super(SongBird, self).__init__()
        self.sound = 'Squawk!'
    def sing(self):
        print self.sound

sb = SongBird() 
sb.sing() 
sb.eat() 
sb.eat()








11.30.super
11.30.1.alternative: the super function.
11.30.2.A list with an access counter
11.30.3.when using the keyword super, and that is why the super() built-in function was eventually added to Python, so you could "do the correct thing" functionally
11.30.4.Using super