summaryrefslogtreecommitdiffstats
path: root/Lib/collections.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2009-01-21 20:31:50 (GMT)
committerRaymond Hettinger <python@rcn.com>2009-01-21 20:31:50 (GMT)
commit4571f347f94a969a21a94d29b40a18a7b4dcd21f (patch)
treec3f86d162dc8fbb104c511da6083c9ff251edb13 /Lib/collections.py
parent42ffbdb9038facbff1db28042a639611c2618ad0 (diff)
downloadcpython-4571f347f94a969a21a94d29b40a18a7b4dcd21f.zip
cpython-4571f347f94a969a21a94d29b40a18a7b4dcd21f.tar.gz
cpython-4571f347f94a969a21a94d29b40a18a7b4dcd21f.tar.bz2
Simplify explanation of multiset operations by removing restrictions on negative inputs.
Diffstat (limited to 'Lib/collections.py')
-rw-r--r--Lib/collections.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/collections.py b/Lib/collections.py
index a853076..eb13f4d2 100644
--- a/Lib/collections.py
+++ b/Lib/collections.py
@@ -312,8 +312,8 @@ class Counter(dict):
if not isinstance(other, Counter):
return NotImplemented
result = Counter()
- for elem, count in self.iteritems():
- newcount = count - other[elem]
+ for elem in set(self) | set(other):
+ newcount = self[elem] - other[elem]
if newcount > 0:
result[elem] = newcount
return result