[Python-ideas] Why no dict.discard?

MRAB python at mrabarnett.plus.com
Tue Aug 7 22:25:20 CEST 2012


The 'set' class has a 'discard' method, but dict doesn't.

I know that I can just delete the key and catch the exception if it's
absent, but I can also 'remove' a member from a set and catch the
exception if it's absent, OR just 'discard' it to avoid an exception.

How much interest would there be in adding 'discard' to dict too?



More information about the Python-ideas mailing list