Skip to content

super()

The built-in super() function provides a way to access methods from a superclass from within a subclass. This function returns a proxy object that delegates method calls to a parent or sibling class, so a subclass can access inherited methods that it has overridden. It’s especially useful for implementing inheritance and extending class functionality:

Language: Python
class Rectangle:
    def __init__(self, length, width):
        self.length = length
        self.width = width

class Square(Rectangle):
    def __init__(self, length):
        super().__init__(length, length)

super() Signature

Language: Python
super()
super(type, object_or_type=None, /)

Arguments

Argument Description Default Value
type Class that anchors the method resolution order (MRO) search. The search starts from the class right after type. Required argument
object_or_type Object or class whose MRO to search. None

Return Value

  • Returns a proxy object that delegates method calls to a parent or sibling class of the specified type.
  • Since Python 3.14, super objects are pickleable and copyable.

super() Examples

With no arguments:

Language: Python
class Rectangle:
    def __init__(self, length, width):
        self.length = length
        self.width = width

class Square(Rectangle):
    def __init__(self, length):
        super().__init__(length, length)

# Usage
square = Square(4)
print(square.length)  # Output: 4

With a two-argument call in a method:

Language: Python
class Rectangle:
    def __init__(self, length, width):
        self.length = length
        self.width = width

class Square(Rectangle):
    def __init__(self, length):
        super(Square, self).__init__(length, length)

# Usage
square = Square(4)
print(square.length)  # Output: 4

super() Common Use Cases

The most common use cases for the super() function include:

  • Accessing methods in a superclass to avoid code duplication.
  • Extending and modifying inherited methods in subclasses.
  • Facilitating cooperative multiple inheritance by following the method resolution order (MRO).

super() Real-World Example

In a real-world scenario, you might use super() to create a class hierarchy for geometric shapes, such as rectangles and squares. This allows you to reuse and extend existing methods without rewriting them:

Language: Python
class Rectangle:
    def __init__(self, length, width):
        self.length = length
        self.width = width

    def area(self):
        return self.length * self.width

class Square(Rectangle):
    def __init__(self, length):
        super().__init__(length, length)

    def perimeter(self):
        return 4 * self.length

# Usage
square = Square(4)
print(square.area())     # Output: 16
print(square.perimeter()) # Output: 16

In this example, super() is used to initialize the Square class with the properties of the Rectangle class, allowing for efficient reuse of the .area() method.

Supercharge Your Classes With Python super()

Tutorial

Supercharge Your Classes With Python super()

In this step-by-step tutorial, you will learn how to leverage single and multiple inheritance in your object-oriented application to supercharge your classes with Python super().

intermediate best-practices python

For additional information on related topics, take a look at the following resources:


By Leodanis Pozo Ramos • Updated Sept. 1, 2026 • Reviewed by Dan Bader