Popular recipes tagged "c3"http://code.activestate.com/recipes/tags/c3/2011-06-11T08:31:09-07:00ActiveState Code RecipesCalculate the MRO of a class (Python) 2011-06-11T08:31:09-07:00Steven D'Apranohttp://code.activestate.com/recipes/users/4172944/http://code.activestate.com/recipes/577748-calculate-the-mro-of-a-class/ <p style="color: grey"> Python recipe 577748 by <a href="/recipes/users/4172944/">Steven D'Aprano</a> (<a href="/recipes/tags/c3/">c3</a>, <a href="/recipes/tags/classes/">classes</a>, <a href="/recipes/tags/method/">method</a>, <a href="/recipes/tags/mro/">mro</a>, <a href="/recipes/tags/order/">order</a>, <a href="/recipes/tags/resolution/">resolution</a>). </p> <p>This function allows you to calculate the Method Resolution Order (MRO, or sometimes linearization) of a class or base classes. This is the so-called "C3" algorithm, as used by Python (new-style classes, from version 2.3 and higher). The MRO is the order of base classes that Python uses to search for methods and attributes. For single inheritance, the MRO is obvious and straight-forward and not very exciting, but for multiple inheritance it's not always obvious what the MRO should be.</p>