Python empty counter comparison

python

Solution

From the `Counter` documentation:

Note: Counters were primarily designed to work with positive integers to represent running counts; however, care was taken to not unnecessarily preclude use cases needing other types or negative values.

As such they are not exactly like multi-sets; they explicitly support values beyond just positive integers, and any keys set to `0` are still considered datapoints.

You can explicitly remove any counters at or below 0 by subtracting an empty `Counter` object:

>>> from collections import Counter
>>> Counter({'a': 0}) - Counter()
Counter()
>>> Counter({'a': 0, 'b': 1, 'c': -1}) - Counter()
Counter({'b': 1})

Problem

Does anyone know why the following is `False` not `True`? Isn't counters supposed to be similar to multisets? Any references to docs welcome. ``` Counter()==Counter({'a': 0}) ```

Original source