What is the MRO and how does super() work with multiple inheritance?

Python classes and OOP · Experienced

Model answer

The method resolution order is the order Python searches classes for a method, computed with the C3 linearisation, and you can see it with Class.__mro__. super() calls the next class in that order, not necessarily the direct parent, which is what makes cooperative multiple inheritance work.

Learn this topic

Classes and Objects in Python: A Gentle Introduction in the course Python for Beginners: Learn to Code with Real Projects.

Sign in to add your own answer.

More questions