MRO problems with diamond inheritance?

Michele Simionato michele.simionato at gmail.com
Mon May 2 04:00:23 EDT 2005


John & Sarah:
> Incidentally, is it safe to have an mro() method in a class, > or is
this
> as reserved as the usual __reserved_words__? Does Python > use mro()
(as
> opposed to __mro__) internally or anything?

.mro() is a metamethod, it is a method of the metaclass, not of the
class. So you can override it without problems, and still access it as
type.mro(cls).

For more about metamethods see
http://www-128.ibm.com/developerworks/linux/library/l-pymeta2/index.html

                   Michele Simionato




More information about the Python-list mailing list