[Python-checkins] r69982 - python/branches/py3k/Doc/library/collections.rst
raymond.hettinger
python-checkins at python.org
Wed Feb 25 23:51:40 CET 2009
Author: raymond.hettinger
Date: Wed Feb 25 23:51:40 2009
New Revision: 69982
Log:
Sync-up 3.1 docs with 2.7 for collections.Counter().
Modified:
python/branches/py3k/Doc/library/collections.rst
Modified: python/branches/py3k/Doc/library/collections.rst
==============================================================================
--- python/branches/py3k/Doc/library/collections.rst (original)
+++ python/branches/py3k/Doc/library/collections.rst Wed Feb 25 23:51:40 2009
@@ -236,13 +236,12 @@
c.most_common()[:-n:-1] # n least common elements
c += Counter() # remove zero and negative counts
-Several multiset mathematical operations are provided for combining
-:class:`Counter` objects. Multisets are like regular sets but are allowed to
-contain repeated elements (with counts of one or more). Addition and
-subtraction combine counters by adding or subtracting the counts of
-corresponding elements. Intersection and union return the minimum and maximum
-of corresponding counts. Each operation can accept inputs with signed counts,
-but the output excludes results with counts less than one.
+Several mathematical operations are provided for combining :class:`Counter`
+objects to produce multisets (counters that have counts greater than zero).
+Addition and subtraction combine counters by adding or subtracting the counts
+of corresponding elements. Intersection and union return the minimum and
+maximum of corresponding counts. Each operation can accept inputs with signed
+counts, but the output will exclude results with counts of zero or less.
>>> c = Counter(a=3, b=1)
>>> d = Counter(a=1, b=2)
More information about the Python-checkins
mailing list