class A(object):
def __init__(self, *args, **kwargs):
print "args is :{}".format(*args)
print "kwargs is:{}".format(kwargs)
class B(A):
def __init__(self, *args, **kwargs):
super(B, self).__init__(*args, **kwargs)
print "B Method:{}".format(*args)
bb = B("Hello", lang="Python")
Python中多继承与super()用法Python类分为两种,一种叫经典类,一种叫新式类。两种都支持多继承。
点赞
收藏