Python学习之路:新式类VS经典类
class Person(object):#新式类 super class Person:#经典类 Person.__init__ #多继承时,顺序的区别--新式类和经典类:在Python3.X中广度查找;在Python2.X中新式类采用广度查找,经典类采用深度查找 class A(object): pass # def __init__(self): # self.n = "A" class B(A): pass # def __init__(self): # self.n = "B" class C(A): def __init__(self): self.n = "C" class D(B,C): pass # def __init__(self): # self.n = "D" d = D() print(d.n)