This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author bethard
Recipients amaury.forgeotdarc, bethard, georg.brandl, gvanrossum, pitrou, rhettinger
Date 2009-01-12.18:55:09
SpamBayes Score 0.011089657
Marked as misclassified No
Message-id <1231786510.88.0.83764793202.issue1696199@psf.upfronthosting.co.za>
In-reply-to
Content
The whole point was to have a function (or class) that accumulates a
sequence and counts it. collections.defaultdict(lambda: 0) doesn't
achieve this on its own because it only knows how to handle sequences of
(key, value):

>>> d = collections.defaultdict(lambda: 0)
>>> d.update('aaabbac')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: dictionary update sequence element #0 has length 1; 2 is
required

The feature request here was mainly a request to provide an abbreviation
of a very common 4-line function.
History
Date User Action Args
2009-01-12 18:55:11bethardsetrecipients: + bethard, gvanrossum, georg.brandl, rhettinger, amaury.forgeotdarc, pitrou
2009-01-12 18:55:10bethardsetmessageid: <1231786510.88.0.83764793202.issue1696199@psf.upfronthosting.co.za>
2009-01-12 18:55:10bethardlinkissue1696199 messages
2009-01-12 18:55:09bethardcreate