super()

super([type[, object-or-type]])
Returns: super object · Updated March 13, 2026 · Built-in Functions
built-in oop inheritance classes

The super() function returns a proxy object that lets you call methods from a parent class. Instead of hardcoding the parent class name, super() looks up the method resolution order (MRO) at runtime. This makes your code more maintainable — if you change the inheritance hierarchy, the super calls still work. You can use it to call parent constructors, extend inherited methods, or delegate to sibling classes in multiple inheritance scenarios.

Syntax

super([type[, object-or-type]])

Parameters

ParameterTypeDefaultDescription
typetype(current class)The class to start searching for parent methods
object-or-typeobject or type(current instance)The instance or class to bind the proxy to

When called with no arguments (the most common case), super() automatically determines both parameters from the execution context. This only works inside a method defined in a class body.

Examples

Calling a parent constructor

class Animal:
    def __init__(self, name):
        self.name = name

class Dog(Animal):
    def __init__(self, name, breed):
        super().__init__(name)  # Call parent constructor
        self.breed = breed

dog = Dog("Buddy", "Golden Retriever")
print(dog.name)
# Buddy

print(dog.breed)
# Golden Retriever

Extending a parent method

class BaseFormatter:
    def format(self, data):
        return str(data)

class PrettyFormatter(BaseFormatter):
    def format(self, data):
        # Call parent method first
        result = super().format(data)
        # Add formatting
        return f"=== {result} ==="

formatter = PrettyFormatter()
print(formatter.format(42))
# === 42 ===

Common Patterns

Cooperative multiple inheritance

When multiple classes inherit from each other, each __init__ must call super() to ensure all initializers run:

class A:
    def __init__(self):
        print("A init")
        super().__init__()

class B(A):
    def __init__(self):
        print("B init")
        super().__init__()

class C(B):
    def __init__(self):
        print("C init")
        super().__init__()

C()
# C init
# B init
# A init

Using super() outside of a class (explicit arguments)

You can call super() with explicit arguments to use it in factory functions or outside class methods:

class Parent:
    def greet(self):
        return "Hello from Parent"

class Child(Parent):
    def greet(self):
        return "Hello from Child"

# Using super with explicit class and instance
obj = Child()
print(super(Child, obj).greet())
# Hello from Parent

Calling a specific parent method

class Repository:
    def save(self, data):
        print(f"Saving: {data}")

class CacheRepository(Repository):
    def save(self, data):
        # Save to cache first
        print(f"Caching: {data}")
        # Then delegate to parent
        super().save(data)

repo = CacheRepository()
repo.save("my_data")
# Caching: my_data
# Saving: my_data

Gotchas

Using super() with incorrect class reference

In Python 3, you typically don’t need to pass the class explicitly. However, if you’re calling super() from a method that’s been overridden or from a different context, you may need to pass both arguments:

class Parent:
    def method(self):
        print("Parent")

class Child(Parent):
    def method(self):
        print("Child before")
        super().method()  # Works in normal method
        print("Child after")

Multiple inheritance and MRO

The Method Resolution Order determines which parent method gets called first. Python uses C3 linearization. You can inspect it with the __mro__ attribute:

class A: pass
class B: pass
class C(A, B): pass

print(C.__mro__)
# (<class '__main__.C'>, <class '__main__.A'>, <class '__main__.B'>, <class 'object'>)

See Also