Remark: O==object
2.PYTHON-C3 Algorithm Analysis:
#C3 definition Reference starts
C3 algorithm: MRO is an ordered list l, which is calculated when the class is created.
L (Child (BASE1,BASE2)) = [Child + merge (L (BASE1), L (BASE2), BASE1BASE2)]
L (object) = [Object]
Properties of L: The result is a list of at least one element in the list that is the class itself.
For example:
L (d) = L (d (O))
= D + merge (L (O))
= D + O
= [D,o]
L (b) = L (b (d,e))
= B + merge (L (D), L (E))
= B + merge (do, EO) # first list do header D, other lists such as EO footer do not contain d, so you can put D, that is, D is the legal header
= B + D + merge (O, EO) #从第一个开始表头是O, but the later list EO's footer contains o so O is not legal, so skip to the next list eo
= B + D + E + merge (o, O)
= [B,d,e,o]
Similarly:
L (C) = [C,e,f,o]
L (A (b,c)) = A + merge (L (B), L (C), BC)
= A + merge (BDEO,CEFO,BC) #B是合法表头
= A + B + merge (deo,cefo,c) #D是合法表头
= A + B + D + merge (eo,cefo,c) #E不是合法表头, jumps to the next list Cefo, at which point C is the legal header
= A + B + D + C + merge (EO,EFO) #由于第三个列表中的C被删除, empty, so there is no third table, only two tables are left, and E is the legal header
= A + B + D + C + E + merge (O,FO) #O不是合法表头, jump to the next list fo,f is a legitimate header,
= A + B + D + C + E + F + merge (o,o) #O是合法表头
= A + B + D + C + E + F + O
= [A,b,d,c,e,f,o]
Reprint python multiple inheritance C3 algorithm