0

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?

UnstableFractal
  • 1,403
  • 2
  • 15
  • 29
  • 1
    or maybe http://stackoverflow.com/questions/5713218/best-method-to-delete-an-item-from-a-dict; the other one was about lists – Sam Jul 08 '15 at 07:06

1 Answers1

1

del is generally faster than pop().

Have a look at this discussion Best way to remove an item from a Python dictionary?

Community
  • 1
  • 1