Stubborn del Operation
Explore how Python handles the del operation and reference counting to manage object deletion. Understand why __del__ may not always be called immediately and how interpreter variables affect object lifecycle.
We'll cover the following...
We'll cover the following...
How can deleting something be so complex?
1.
Let’s delete SomeClass() objects in the interactive interpreter below.
Phew, deleted at last. You might have guessed what saved __del__ from being called in our first attempt to delete x.
2.
Let’s add more twists to the ...