i am trying to check how new , init and del works and was running below mentioned code , what caught my attention is destructor is being called twice and i don't know the exact reason of it, Can anyone help with it?
class Example:
# creation of new instance
def __new__(cls):
print("example created", object.__new__(cls))
return object.__new__(cls)
# Initializing
def __init__(self):
print("Example Instance.")
# Calling destructor
def __del__(self):
print("Destructor called, Example deleted.")
obj = Example()
del obj