...

/

Stubborn del Operation

Stubborn del Operation

We'll cover the following...

How can deleting something be so complex?

Press + to interact
class SomeClass:
def __del__(self):
print("Deleted!")

1.

Let’s delete SomeClass() objects in the interactive interpreter below.

Press + to interact
>>> x = SomeClass()
>>> y = x
>>> del x # this should print "Deleted!"
>>> del y
Deleted!
Terminal 1
Terminal
Loading...

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 ...