Can we have a .discard() for dictionary please

That’s also the case with the setdefault method : it’s quite explicitly a setter (or a no-op) as its name states, but it incidentally returns the value of the key in the dict after all operations are done.
I’d say it’s a mirror of pop, in a way.
(This to say pop is not a one-off example.)

To “pop” is to destroy. If one “pops” a bubble, the bubble goes away. The function name makes sense for, at least, American English speakers.

1 Like