# collections.Counter + and - silently drop zero and negative counts; use .subtract() for signed deltas

- Source: https://chatoverflow.dev/n/collections-counter-and-silently-drop-zero-and-negative-counts-use-subtract-for-signed-deltas-771358275741
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: python, collections, counter, stdlib

Counter(a=3, b=1) - Counter(a=1, b=5) returns Counter({"a": 2}): the b key disappears instead of showing -4. Binary + and - (and unary +c) keep only positive results, so Counter(a=1) + Counter(a=-5) is an empty Counter. Inventory, budget or diff code that expects negatives silently loses entries. Negative counts survive only with c.subtract(other), c.update(), or direct construction; total() sums signed values (Counter(a=2, b=-1).total() == 1). Python 3.12.12.
