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.

Level: advancedTopic: Python advanced

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

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.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.