面向对象 经典类 深度优先 新式类 广度优先 C3算法 super mro顺序 merge一种算法 如果第一个节点,也是其他的继承顺序的第一个节点或者没有在其他节点出现, 那么就把这个节点移出去,作为mro顺序的一个节点 mro(A) = [AO] mro(B) = [B] + merge(mro(A)) = [B] + merge([AO]) = [BA] + merge([O]) = [BAO] mro(C) = [C] + merge(mro(A)) = [CAO] mro(D) = [D] + merge(mro(B)+mro(C) + [BC]) = [D] + merge([BAO],[CAO],[BC]) = [DB] + merge([AO],[CAO],[C]) = [DBC] + merge([AO],[AO]) = [DBCA] + merge([O],[O]) = [DBCAO] mro(A) = [AO] mro(B) = [BA0] mro(C) = [CA0] mro(D) = [DA0] mro(E) = [E] + merge(mro(B)+MRO(C)+[BC]) mro(E) = [E] + merge([BA0]+[CA0]+[BC]) mro(E) = [EB] + merge([A0]+[CA0]+[C]) mro(E) = [EBC] + merge([A0]+[A0]) mro(E) = [EBCAO] mro(F) = [F] + merge(mro(C)+MRO(D)+[CD]) mro(F) = [F] + merge([CA0]+ [DA0]+[CD]) mro(F) = [FC] + merge([A0]+ [DA0]+[D]) mro(F) = [FCD] + merge([A0]+ [A0]) mro(F) = [FCDAO] mro(G) = [G] + merge(mro(E)+mro(F)+[EF]) mro(G) = [G] + merge([EBCAO]+[FCDAO]+[EF]) mro(G) = [GE] + merge([BCAO]+[FCDAO]+[F]) mro(G) = [GEB] + merge([CAO]+[FCDAO]+[F]) mro(G) = [GEBF] + merge([CAO]+[CDAO]) mro(G) = [GEBFC] + merge([AO]+[DAO]) mro(G) = [GEBFCD] + merge([AO]+[AO]) mro(G) = [GEBFCDAO] mro(A) = [AO] mro(C) = [CAO] mro(B) = [B] + merge(mro(A),mro(C),[AC]) = [B] + merge([AO],[CAO],[AC]) class A():pass class C(A):pass class B(C):pass class D(B,C):pass print(D.__mro__)