Dynamic Attribute Lookup: The MRO Traversal Cost

For every method call, Python's interpreter performs a dynamic attribute lookup, traversing the Method Resolution Order (MRO) of the class hierarchy, which is a significant overhead not present in statically compiled languages. This `PyType_Lookup` operation is a primary factor in method resolution slowness.

Sources

Open the full topic