如何在Python 3.0中调用super()?
我在使用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()
>>>