mro() or __mro__?

Hrvoje Niksic hniksic at xemacs.org
Sat Oct 23 06:14:06 EDT 2010


The documentation of the mro() method on the class object says:

class.mro()
    This method can be overridden by a metaclass to customize the method
    resolution order for its instances. It is called at class instantiation,
    and its result is stored in __mro__.

Am I interpreting it correctly that the "__mro__" attribute is intended
to be used directly, while the "mro" method is intended to be optionally
overridden by the metaclass implementor?

If that is the case, it sounds exactly the opposite to the normal python
convention that __methods__ are part of the protocol, and
underscore-less functions or methods are meant to be called by the end
user of the class.



More information about the Python-list mailing list