Skip to content

Latest commit

 

History

History
10 lines (7 loc) · 560 Bytes

File metadata and controls

10 lines (7 loc) · 560 Bytes

Inheritance in Python


How Methods Are Executed When a Class Is Inherited

  • Assuming an instance's method is to be executed, the bound method is retrieved via __getattribute__() and then the method is executed
  • The order in which methods are retrieved follows the __mro__
    • MRO (method resolution order) is the order in which methods are looked up
    • Whether it's single inheritance or multiple inheritance, the order in which methods are accessed is stored in that class's __mro__, with items further to the left having higher priority