In Python, super() returns a proxy object that forwards method calls to the next class in the method resolution order (MRO), which for simple inheritance is the parent class. The most common use is super().__init__(...) to run the parent's setup in a subclass.
With multiple inheritance, βnextβ follows the MRO, not just the first parent, so every class in a diamond is called exactly once when each one uses super(). Inside a method, the zero-argument form super() works automatically; super(Class, obj) is the explicit form.
super is a built-in type (a class) that you call like a function: each call creates a new super object. Like every built-in, it lives in the builtins module and is always available without an import.
Syntax
Call it inside a method, then call the method you want on the result.
python
class Child(Parent):
def __init__(self, x, y):
super().__init__(x)
self.y = y
Call
What it does
super().__init__(...)
Runs the parent's initializer.
super().method()
Calls the overridden parent version.
super(Child, self)
Explicit form, same as super() in a method.
Child.__mro__
Shows the order super() follows.
super() is a built-in type you call like a function; the zero-argument form only works inside a method defined in a class body.
Library declarations
python
super()
super(type, object_or_type=None, /)
# class super: a proxy that follows the MRO
Parameters
Parameter
Description
type
Optional. The class to start searching after. Filled in automatically inside methods.
object_or_type
Optional. The instance (or class) to bind to, usually self.
Return Value
Return Value
Description
super
A proxy object; attribute lookups on it go to the next class in the MRO.
Python Examples
Example 1 — Extend __init__ and a Method
Reuse the parent's initializer and build on its speak() method.
python
class Animal:
def __init__(self, name):
self.name = name
def speak(self):
return self.name + " makes a sound"
class Dog(Animal):
def __init__(self, name, breed):
super().__init__(name)
self.breed = breed
def speak(self):
return super().speak() + " (woof)"
rex = Dog("Rex", "beagle")
print(rex.name, rex.breed)
print(rex.speak())
Output
Rex beagle
Rex makes a sound (woof)
How It Works
Shared setup.super().__init__(name) lets Animal set self.name.
Add your own. Dog then stores the extra breed attribute.
Extend, not replace.Dog.speak calls the parent version and appends to its result.
No class names hard-coded. Writing super() instead of Animal keeps working if the hierarchy changes.
Example 2 — super() Follows the MRO in a Diamond
Chain super() calls through two parents that share a base class.
python
class Base:
def hello(self):
return ["Base"]
class Left(Base):
def hello(self):
return ["Left"] + super().hello()
class Right(Base):
def hello(self):
return ["Right"] + super().hello()
class Child(Left, Right):
def hello(self):
return ["Child"] + super().hello()
print(Child().hello())
print([cls.__name__ for cls in Child.__mro__])