super() is linear. Your brain is not.You have class A, B, C. Multiple inheritance. You call
super().method() inside B. Which method runs? Not necessarily the parent of B. It depends on the Method Resolution Order of the instance.Most developers learn MRO once, forget it, then get confused when
super() jumps sideways instead of up.Take this:
class A:
def f(self): print("A")
class B(A):
def f(self): print("B"); super().f()
class C(A):
def f(self): print("C"); super().f()
class D(B, C):
def f(self): print("D"); super().f()
D().f() prints D, B, C, A. Not B then A. Because super() in B calls next in MRO which is C, not A.This is not a bug. It's cooperative multiple inheritance. It allows mixins and dependency injection. But if you don't understand it, you will spend hours wondering why
super().f() skipped a generation.✔️ The rule:
super() follows the MRO, not the parent hierarchy. Print ClassName.__mro__ before you debug.