Author bethard
Recipients
Date 2007-04-07.21:38:28
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
As suggested in http://mail.python.org/pipermail/python-list/2007-April/433986.html this is a patch to add a counts() function to the collections module. Usage looks like:

>>> items = 'acabbacba'
>>> item_counts = counts(items)
>>> for item in 'abcd':
...     print item, item_counts[item]
...
a 4
b 3
c 2
d 0

Yes, it's only a 4-line function, but it's a frequently re-written 4-line function.
History
Date User Action Args
2007-08-23 14:52:59adminlinkissue1696199 messages
2007-08-23 14:52:59admincreate