[issue10930] dict.setdefault: Bug: default argument is ALWAYS evaluated, i.e. no short-circuit eval

Eric Smith report at bugs.python.org
Tue Jan 18 16:28:06 CET 2011


Eric Smith <eric at trueblade.com> added the comment:

Or use a collections.defaultdict, which has a factory function as a constructor argument. It sort of depends on what you're trying to do.

----------
nosy: +eric.smith

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


More information about the Python-bugs-list mailing list