我有一些奇怪的错误,我在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()
>>>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
881 次 |
| 最近记录: |