AI engineering glossary · Python advanced
What is MRO (method resolution order)?
Method resolution order (also called MRO, C3 linearization): The linear order in which Python searches a class and its ancestors when looking up an attribute or method. It is computed with the C3 linearisation algorithm so each class appears before its parents and multiple inheritance stays consistent.
Method resolution order: an example
Calling C.__mro__ for class C(A, B) shows something like (C, A, B, object), the order Python checks for methods.
Related terms
- Multiple inheritance
- super()
- Inheritance
- Diamond problem
More Python advanced terms
Where you learn it
Method resolution order is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.