Super Function

Console Output
>

Super Function Visualization

What is super()?

The super() function returns a proxy object that delegates method calls to a parent or sibling class.

super().method() → calls parent's method

Current Configuration

Type

Method Override with super() - Extends parent method functionality

Super Call

super().method() - Calls parent method and enhances result

Classes

AnimalDog

Method

speak()

Method Resolution Order (MRO)

Dog
Animal
object

When super() is called in Dog, it looks for the next class in MRO

Class Hierarchy

Animal

Base Class

Parent
def speak(self):
    return "Animal speak method called"
Dog

Derived Class

Child
def speak(self):
    return super().speak() + " - Enhanced by Dog"

Execution Flow

1

my_dog.speak() called

2

Dog.speak() executes

3

super().speak() calls Animal.speak()

4

Animal.speak() returns "Animal speak method called"

5

Final result: "Animal speak method called - Enhanced by Dog"

Super Function Benefits

Avoids hardcoding parent class names
Handles multiple inheritance correctly
Resolves diamond problem automatically
Maintains cooperative multiple inheritance