summaryrefslogtreecommitdiffstats
path: root/Doc/library/collections.rst
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2009-02-25 22:51:40 (GMT)
committerRaymond Hettinger <python@rcn.com>2009-02-25 22:51:40 (GMT)
commit72a95cc7b0ff2909b552e76ed409500f385d0258 (patch)
tree7db466f0baf9ce50fa7cace6dbdc2c188fc318db /Doc/library/collections.rst
parent0f31e6db36b19fecb403f7eb75d136aad9186e54 (diff)
downloadcpython-72a95cc7b0ff2909b552e76ed409500f385d0258.zip
cpython-72a95cc7b0ff2909b552e76ed409500f385d0258.tar.gz
cpython-72a95cc7b0ff2909b552e76ed409500f385d0258.tar.bz2
Sync-up 3.1 docs with 2.7 for collections.Counter().
Diffstat (limited to 'Doc/library/collections.rst')
-rw-r--r--Doc/library/collections.rst13
1 files changed, 6 insertions, 7 deletions
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst
index 4b3bbe9..c28704b 100644
--- a/Doc/library/collections.rst
+++ b/Doc/library/collections.rst
@@ -236,13 +236,12 @@ Common patterns for working with :class:`Counter` objects::
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)