You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been considering this a problem with super as it works in the examples without super but finally got a simple example that shows the difference without using super:
CPython:
>>> (1).__new__(int, 5)
5
RustPython:
>>>>> (1).__new__(int, 5)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Expected type <class 'type'>, not <class 'int'>
Uh oh!
There was an error while loading. Please reload this page.
In RustPython, __new__ is bound method but it should be a static method.
super().new(cls, *args, **kwargs) will pass two same ype class(args[0] is same as cls).
object __new__ Python docuemtion
The text was updated successfully, but these errors were encountered: