I have created a list in Python
>>> my_list = [1, 2, 3, 4]
Now if I want to delete the list, I would like to use the del
operator like
>>> del my_list
This works fine and is probably the general way of using it. But somewhere I stumbled upon an unusual syntax
>>> del[my_list]
And this does the same thing! And now I am kind of confused how del actually works. I can understand the previous syntax with del
being a built-in statement, but the second syntax looks like an indexing to me.