summaryrefslogtreecommitdiffstats
path: root/Lib/collections.py
diff options
context:
space:
mode:
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