【发布时间】:2010-11-24 06:20:56
【问题描述】:
我遇到了一段时间以来在 Python(3.0 版)中看到的最奇怪的错误。
更改函数的签名会影响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()
>>>
【问题讨论】:
标签: python python-3.x