[issue25016] defaultdict's pop gives a KeyError

Martin Panter report at bugs.python.org
Mon Sep 7 08:37:47 CEST 2015


Martin Panter added the comment:

I think this is by design. Under <https://docs.python.org/3/library/collections.html#collections.defaultdict.__missing__> it says “__missing__() is _not_ called for any operations besides __getitem__().” What gave you the impression that pop() should return a default value?

----------
nosy: +martin.panter

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25016>
_______________________________________


More information about the Python-bugs-list mailing list