python-经典类和新式类区别
经典类和新式类区别
Eg:
class A(object):
def x(self):
print('A')
class B(A):
def x(self):
print('B')
# pass
class C(A):
def x(self):
print('C')
class D(B,C):
pass
s = D()
s.x()
Python3里面没有区别
经典类和新式类没区别,都是广度优先
Python2 里面:
多继承时:
经典类(class Duan() )是深度优先,
新式类(class Duan(object))是广度优先
经典类里面不能用super