[issue10533] defaultdict constructor with a concrete value

Michael Foord report at bugs.python.org
Thu Nov 25 18:07:24 CET 2010


Michael Foord <michael at voidspace.org.uk> added the comment:

I would love this functionality (I almost always initialise defaultdict with a lambda that just returns a concrete value).

Unfortunately it seems like adding a keyword argument isn't possible because defaultdict takes arbitrary keyword args (and populates the dict with them).

    defaultdict(lambda: 1, foo=1, bar=2, baz=3)

----------

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


More information about the Python-bugs-list mailing list