Name

super

Examples
class Robot(object):
  def speak(self):
    print("BZZT BOOP BEEP")

class RoboFeline(Robot):
  def speak(self):
    super(RoboFeline, self).speak()
    print("MEOW PURR PURR")

kitty = RoboFeline()
kitty.speak()
# Prints:
# BZZT BOOP BEEP
# MEOW PURR PURR
class Animal(object):
  def __init__(self):
    self.leg_count = 6

class Grasshopper(Animal):
  def __init__(self):
    # call the __init__ method of parent class
    super(Grasshopper, self).__init__()

hopsalot = Grasshopper()
print(hopsalot.leg_count) # Prints 6
Description
Syntax
super(class, self)
Parameters
class
Related class
Updated on Wed Jan 18 17:32:21 2017.
Creative Commons License