擅长:python、mysql、java
<p>你自己回答了这个问题-第二个<code>object</code>是多余的。类C有两个基:object和StrMixin。然而,StrMixin的基也是object,所以它会混淆它应该首先解析哪个对象。MRO将其计算为(C,STRMixin,object,object),其中有重复的对象。在这种特殊情况下,解决方案应该是什么似乎是显而易见的,但是增加几个类,MRO可能变得不那么清晰。E、 g</p>
<pre><code>class A(object):
pass
class B(object, A):
pass
class C(object, A):
pass
class D(object, B, C):
pass
class E(object, A, D):
pass
</code></pre>
<p>E的MRO是什么?不管它是什么,它真的很复杂,有重复的,可能还有几个循环。在</p>
<p>MRO解释得很好<a href="http://www.python.org/download/releases/2.3/mro/" rel="nofollow">here</a>,您的具体情况在页面下面三分之二处被处理,第一个例子是“Bad Method Resolution Orders”。在</p>