Éric Araujo <mer...@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 <rep...@bugs.python.org> <http://bugs.python.org/issue10533> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com