Inheritance
super() Function
Calling parent class methods and cooperative multiple inheritance
Interview: Essential — tests understanding of super() with __init__, cooperative inheritance, and MRO-based dispatch
The super() function returns a proxy object that delegates method calls to the next class in the MRO. It's the standard way to call parent class methods without hardcoding the parent class name. Understanding super() deeply is essential for cooperative multiple inheritance.
Basic Usage
super().__init__(args)— call parent constructorsuper().method()— call parent method- Always use
super()instead ofParentClass.method(self) super()follows MRO, not just "the parent class"
Cooperative Multiple Inheritance
When all classes use super(), method calls follow the MRO chain cooperatively. Each class in the hierarchy calls super(), ensuring all classes get their turn. This is critical for mixins and complex hierarchies.
super() with __init__
The most common use of super() is in __init__ to ensure parent initialization runs. You can pass extra arguments to super().__init__() or handle child-specific args separately.
Interview Tip
Know that super() doesn't mean "call the parent class" — it means "call the next class in the MRO." In multiple inheritance, the next class might be a sibling, not a parent!
Use Cases
Calling parent constructor in subclass __init__
Extending parent methods (adding behavior, not just replacing)
Cooperative multiple inheritance with mixins
Skipping levels in inheritance hierarchy with super(Class, self)
`**kwargs` pattern for flexible multi-parent initialization
Common Mistakes
Forgetting super().__init__() — parent attributes not initialized
Using ParentClass.__init__(self) instead of super() — breaks MRO in multiple inheritance
Not passing `**kwargs` through super().__init__() — breaks cooperative inheritance
Thinking super() always calls the direct parent — it follows MRO, not hierarchy
Calling super() outside a method (requires explicit class and instance arguments)