如何在Python中调用超级构造函数?
发布于 2021-02-02 23:16:06
class A:
def __init__(self):
print("world")
class B(A):
def __init__(self):
print("hello")
B() # output: hello
在所有其他与super构造函数一起使用的语言中,都是隐式调用的。如何在Python中调用它?我希望super(self)
这是行不通的。
关注者
0
被浏览
90
1 个回答