This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author crypdick
Recipients crypdick
Date 2021-11-30.02:43:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1638240183.83.0.336191695201.issue45936@roundup.psfhosted.org>
In-reply-to
Content
In brief:

```
from collections import Counter
x = Counter({'a': 0, 'b': 1})
x.update(x)  # works: Counter({'a': 0, 'b': 2})
x += x  # expected: Counter({'a': 0, 'b': 3}) actual: Counter({'b': 3})
```

I expect `+=` and `.update()` to be synonymous. However, the += operator is deleting keys if the source Counter has a zero count to begin with:

```
x = Counter({'a': 1})
x += Counter({'a': 0})  # ok: Counter({'a': 1})

y = Counter({'a': 0})
y += y  # expected: Counter({'a': 0}) actual: Counter()
```
History
Date User Action Args
2021-11-30 02:43:03crypdicksetrecipients: + crypdick
2021-11-30 02:43:03crypdicksetmessageid: <1638240183.83.0.336191695201.issue45936@roundup.psfhosted.org>
2021-11-30 02:43:03crypdicklinkissue45936 messages
2021-11-30 02:43:03crypdickcreate