Python method resolution order: Inheriting methods from a parent

Python method resolution order: Inheriting methods from a parent

Thanks to ICPO/MRO, if a child Python class doesn’t define a method, the parent method will be invoked:

class Parent:
    def x(self):
        return 'x from Parent'
class Child(Parent):
    pass
c = Child() 
# x isn't on c
# x is on c's class
c.x() # 'x from Parent'