summaryrefslogtreecommitdiffstats
path: root/Lib/collections.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2009-01-21 20:36:27 (GMT)
committerRaymond Hettinger <python@rcn.com>2009-01-21 20:36:27 (GMT)
commite0d1b9f11fc10cc2fb797606dc55967a66821529 (patch)
tree2a8ae4cab2ea1614a2ef2f7f3c6557b08862fd20 /Lib/collections.py
parent63b3a97a2a7277fb05e2aeaee9890a25fb385702 (diff)
downloadcpython-e0d1b9f11fc10cc2fb797606dc55967a66821529.zip
cpython-e0d1b9f11fc10cc2fb797606dc55967a66821529.tar.gz
cpython-e0d1b9f11fc10cc2fb797606dc55967a66821529.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 45558f9..232c772 100644
--- a/Lib/collections.py
+++ b/Lib/collections.py
@@ -314,8 +314,8 @@ class Counter(dict):
if not isinstance(other, Counter):
return NotImplemented
result = Counter()
- for elem, count in self.items():
- newcount = count - other[elem]
+ for elem in set(self) | set(other):
+ newcount = self[elem] - other[elem]
if newcount > 0:
result[elem] = newcount
return result