diff options
author | Raymond Hettinger <python@rcn.com> | 2009-01-21 20:31:50 +0000 |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2009-01-21 20:31:50 +0000 |
commit | 95efd905a05b1f84acf9c12d095c04e33d980738 (patch) | |
tree | c673e0a54a5ae77f4f61f90373d6466e6807bbe9 /Lib/collections.py | |
parent | c5e8ea8fa2c489af014944addf15167a1835bc84 (diff) | |
download | cpython-95efd905a05b1f84acf9c12d095c04e33d980738.tar.gz |
Simplify explanation of multiset operations by removing restrictions on negative inputs.
Diffstat (limited to 'Lib/collections.py')
-rw-r--r-- | Lib/collections.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/collections.py b/Lib/collections.py index a853076cb2..eb13f4d2fd 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 |