DEV Community

Discussion on: Constructors in Python (__init vs __new__)

Collapse
 
stevenlu2004 profile image
Tongyu Lu • Edited

You can actually use

super().method_name(*args, **kw)  # PEP 3135
Enter fullscreen mode Exit fullscreen mode

In this case, it can be

super().__new__(cls, *args, **kw)
Enter fullscreen mode Exit fullscreen mode

The cls is actually necessary for __new__.

See more about PEP 3135 →

Collapse
 
algorithm_architech profile image
Adyasha Mohanty

Thank you for making me clear in new and init