[issue19542] WeakValueDictionary bug in setdefault()&pop()

Tim Peters report at bugs.python.org
Mon Dec 9 04:55:35 CET 2013


Tim Peters added the comment:

The weakref.slice fix looks solid to me, although it appears to be specific to 2.7 (the methods are fancier on the current default branch, fiddling with self._pending_removals too).

Does anyone know why the signature of pop is:

    def pop(self, key, *args)

?  It doesn't make sense to me to accept any number of arguments following `key`.  Perhaps it's just an obscure way to avoid doing:

_noarg = object()  # unique sentinel

def pop(self, key, default=_noarg):

?

----------
nosy: +tim.peters

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


More information about the Python-bugs-list mailing list