Python › Multiple Inheritance & MRO

What is multiple inheritance in Python, and how does it differ from single inheritance?

Beginner

Answer

Multiple inheritance lets a class inherit from more than one base class simultaneously, combining attributes and methods from all of them, unlike single inheritance where a class has exactly one direct parent. Python supports this natively via `class Child(Base1, Base2):`, unlike languages like Java that only allow single class inheritance (using interfaces instead).
class Flyer:
    def fly(self): return 'Flying'

class Swimmer:
    def swim(self): return 'Swimming'

class Duck(Flyer, Swimmer):
    pass

d = Duck()
print(d.fly(), d.swim())  # Flying Swimming
Real-world example A game engine's Character class inherits from both Movable and Damageable mixins, combining movement and health mechanics without duplicating code across every character type.

Common follow-ups: What problems can multiple inheritance introduce (diamond problem)?;How does Python resolve method lookup order with multiple bases?