On Fri, Nov 2, 2018 at 5:25 PM Anders Hovmöller <bo...@killingar.net> wrote:
> Could you explain what the difference is between defaultdicts "factory > which is unconditionally called when the key is missing" and "the default > is evaluated only on need"? > The distinction was the motivation for this thread: setdefault requires a constructed default instance as an argument, regardless of whether the key is missing, whereas defaultdict's factory is only called if necessary. If the key is present in a defaultdict, no default is constructed.
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/