我看到一段代码
class IBapi(EWrapper, EClient):
def __init__(self):
EClient.__init__(self, self)我不明白self, self是做什么的。我已经习惯了这样的事情。
class TestClient(EClient):
def __init__(self, wrapper):
EClient.__init__(self, wrapper)有人能解释一下self, self吗?
发布于 2020-12-12 23:59:15
self是"IBapi“类的对象,也是继承的"EWrapper”和"EClient“类的实例。我猜"EClient“的构造函数获取了"EWrapper”的一个实例作为参数。你可以这样想你的代码:
class IBapi(EWrapper, EClient):
def __init__(self):
wrapper = self
EClient.__init__(self, wrapper)https://stackoverflow.com/questions/65266859
复制相似问题