Interview Q&A / Python
Python interview questions
Lists, dictionaries, generators, decorators and the Python questions asked in service-company and data roles.
Prefer rapid revision? Practise Python short interview answers →
- What is the Method Resolution Order (MRO) in Python, and how does it work with multiple inheritance?
The MRO is the order in which Python searches a class and its parents for an attribute. It uses C3 linearization: children come before parents, and the order of bases you wrote is kept. You can see it with ClassName.__mro__ or mro().
AdvancedQuick answer1 min read