8. Dunder new Method
__new__ is a special method responsible for creating new instances of a class.
Example
class Singleton:
_instance = None
def __new__(cls, *args, **kwargs):
if cls._instance is None:
cls._instance = super().__new__(cls)
return cls._instance
a = Singleton()
b = Singleton()
print(a is b) # True
Wrap-Up
__new__ controls object creation, often used in patterns like Singleton.