我有一段時間在Python中看到的最奇怪的錯誤(版本3.0)。如何在Python 3.0中調用super()?
更改函數的簽名會影響super()
是否有效,儘管它沒有參數。你能解釋爲什麼發生這種情況嗎
感謝,
克里斯
>>> class tmp:
... def __new__(*args):
... super()
...
>>> tmp()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 3, in __new__
SystemError: super(): no arguments
>>> class tmp:
... def __new__(mcl,*args):
... super()
...
>>> tmp()
>>>