1、多繼承(super().__init__())、*args和**kwargs、
https://blog.csdn.net/xiaoqiangclub/article/details/104837537
2、python中super().__init__()
3、
我們嘗試下面代碼,加入super(A, self).__init__()時調用A的父類Root的屬性和方法(方法里對Root數據進行二次操作)
class Root(object):
def __init__(self):
self.x = '這是屬性'
def fun(self):
print(self.x)
print('這是方法')
class A(Root):
def __init__(self):
super(A,self).__init__()
print('實例化時執行')
test = A() # 實例化類
test.fun() # 調用方法
test.x # 調用屬性
結果輸出如下
實例化時執行
這是屬性
這是方法
————————————————
4、
https://www.runoob.com/w3cnote/python-super-detail-intro.html