negative "counts" in collections.Counter?

Vlastimil Brom vlastimil.brom at
Mon Mar 8 23:24:43 CET 2010

2010/3/8 Raymond Hettinger <python at>:
[snip detailed explanations]
> In this case, we have an indication that what you really want is
> a separate class supporting elementwise binary and unary operations
> on vectors (where the vector fields are accessed by a dictionary
> key instead of a positional value).
>> Additionally, were issubset and issuperset considered for this
>> interface (not sure whether symmetric_difference would be applicable)?
> If the need arises, these could be included.  Right now, you
> can get the same result with:  "if a - b: ..."
> FWIW, I never liked those two method names.  Can't remember whether
> a.issubset(b) means "a is a subset of b" or "b issubset of a'.
> Raymond
> --
Thanks for the further remarks Raymond,
initially I thought while investigating new features of python 3, this
would be a case for replacing the "home made" solutions with the
standard module functionality.
Now I can see, it probably wouldn't be an appropriate decision in this
case, as the expected usage of Counter with its native methods is

As for the issubset, issuperset method names, I am glad, a far more
skilled person has the same problem like me :-)   In this case the
operators appear to be clearer than the method names...


More information about the Python-list mailing list