[New-bugs-announce] [issue6893] defaultdict example in py3 doc should mention the new Counter class

Ezio Melotti report at bugs.python.org
Sat Sep 12 05:03:43 CEST 2009


New submission from Ezio Melotti <ezio.melotti at gmail.com>:

The 3rd example of defaultdict [1] shows how to use it to count the
letters of a string, but the new Counter class is a better tool for
doing that.

Possible solutions:
1) "Setting the default_factory to int makes the defaultdict useful for
counting (like a bag or multiset in other languages):" -> "Setting the
default_factory to int makes the defaultdict useful for basic counting
(see also the Counter class for more features):";
2) remove the example.

[1]:
http://docs.python.org/dev/py3k/library/collections.html#defaultdict-examples

----------
assignee: georg.brandl
components: Documentation
messages: 92534
nosy: ezio.melotti, georg.brandl, rhettinger
priority: low
severity: normal
status: open
title: defaultdict example in py3 doc should mention the new Counter class
versions: Python 3.1, Python 3.2

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


More information about the New-bugs-announce mailing list