Browse OOP reference
Types and contracts

What is multiple inheritance?

On this page

Multiple inheritance permits a class to inherit from several bases. Python uses a method resolution order to linearise the hierarchy. Inspect Child.__mro__ when debugging a diamond. Cooperative methods that call super() participate in that order and need compatible signatures.

Worked example

Python
class Base:
    def labels(self):
        return []
class Signed(Base):
    def labels(self):
        return ["signed"] + super().labels()
class Cached(Base):
    def labels(self):
        return ["cached"] + super().labels()
class Report(Signed, Cached):
    pass

assert Report().labels() == ["signed", "cached"]

Python tutorial on classes

Explore class relationships in the OOP Playground

What is a method?What is method overloading?What are mixins?

All OOP questions

Search ObjectFAQ