python mro

看django代码时发现了一个语句:db_field.__class__.mro(),查了下python的帮助没有发现有mro的说明。
写代码实验了一下,mro的功能是返回从object继承的类的继承树列表,如下:
>>> class test(object):
...     pass
...
>>> o=test()
>>> o.__class__.mro
<built-in method mro of type object at 0x02704D70>
>>> o.__class__.mro()
[<class '__main__.test'>, <type 'object'>]
>>> test.mro()
[<class '__main__.test'>, <type 'object'>]
>>>

你可能感兴趣的:(python,django)