[issue10221] {}.pop('a') raises non-standard KeyError exception

Raymond Hettinger report at bugs.python.org
Thu Oct 28 18:37:52 CEST 2010


Raymond Hettinger <rhettinger at users.sourceforge.net> added the comment:

I agree with the OP's request.

d.pop(k) is conceptually equivalent to:
   r = d[k]    # raises KeyError(k)
   del d[k]
   return r

The current message was probably borrowed from dict.popitem().  But that is much different since the dict.pop(k) method is key-specific (instead of size related).

This fix should be backported (as it doesn't change guaranteed behaviors but does improve the debugability).

----------
assignee:  -> rhettinger
stage:  -> needs patch
versions: +Python 2.7, Python 3.1

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


More information about the Python-bugs-list mailing list