Musings & ramblings of a Pythonista
People are often confused about Python's del
keyword and __del__()
method.
Most people think that applying del
on an object causes the object's
__del__()
method to be called. But this is not true. del
keyword merely
decrements the objects reference count and de-scopes the variable on its
application. But it doesn't necessarily invoke the object's __del__()
method.
__del__
method will be called only when the garbage ...