[issue10533] defaultdict constructor with a concrete value

Éric Araujo report at bugs.python.org
Thu Nov 25 18:55:21 CET 2010


Éric Araujo <merwok at netwok.org> added the comment:

Like three-liners?  whatsnew/2.5 gives us this one:

class zerodict(dict):
    def __missing__(self, key):
        return 0

I don’t think it’s too painful to have to use defaultdict with a lambda.  We can’t use a keyword argument and I’m -0.5 on changing behavior depending on the type of the first argument.

----------
nosy: +eric.araujo

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


More information about the Python-bugs-list mailing list