class A():
def __init__(self):
print('A')
class B(A):
def __init__(self):
super(B, self).__init__()
b = B()
**在py2下执行报错了
super(B, self).__init__()
TypeError: must be type, not classobj**
如果父类A使用新式类则没有问题
class A(object):
def __init__(self):
print('A')
为什么!!!????
super说明 中写到
super(type[, object-or-type])
Note: super() only works for new-style classes.