I've found 2 ways of doing it:
del dict[key]
vs
dict.pop(key)
Which one is better and why, or maybe there's more?
I've found 2 ways of doing it:
del dict[key]
vs
dict.pop(key)
Which one is better and why, or maybe there's more?
del is generally faster than pop().
Have a look at this discussion Best way to remove an item from a Python dictionary?