Demystifying Python Method Resolution Order

01:45 PM - 02:10 PM on July 17, 2016, Room CR4

AMiT Kumar

Audience level:
intermediate

Description

This talk is based on the method resolution order which defines the "class search path" used by Python to search for the right method to use in classes having multi-inheritance.

Abstract

This talk is based on the method resolution order which defines the "class search path" used by Python to search for the right method to use in classes having multi-inheritance. Brief Background: It all started with a post by Samuele Pedroni to the Python development mailing list on 1 Oct 2002. In his post, Samuele showed that the Python 2.2 method resolution order is not monotonic and he proposed to replace it with the C3 method resolution order. Guido agreed with his arguments and therefore now Python 2.3 uses C3. Hence, Python uses two algorithms for method resolution order. The Old MRO algorithm is very straight forward but the new one is not so easy to bring out. I will be discussing and explaining both the algorithm and I would also be talking a a bit about the background of this change and the benefits of new C3 Method Resolution Order.