Chapter 10: Understanding Method Resolution Order of Inheritance
In this chapter, we will look at the concept of method resolution order (MRO) in Python 3 and how it works on inheritance.
As the name suggests, MRO is the order in which methods of a class get resolved while calling them in a program.
Throughout this chapter, we will look at understanding the MRO through a few examples, how method resolution can go wrong, and how the current Python 3 implementation handles methods defined in a class. We will be making use of MRO throughout this chapter to understand the behavior of code while inheritance is implemented in Python 3.
Why should we understand MRO? In scenarios where we are using multiple classes in Python code, we need to inherit ...
Get Metaprogramming with Python now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.