Simplify explanation of multiset operations by removing restrictions on negative inputs.

This commit is contained in:
Raymond Hettinger 2009-01-21 20:36:27 +00:00
parent 63b3a97a2a
commit e0d1b9f11f
3 changed files with 17 additions and 24 deletions

View file

@ -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