negative "counts" in collections.Counter?

Gregory Ewing greg.ewing at canterbury.ac.nz
Mon Mar 8 17:22:28 EST 2010


Raymond Hettinger wrote:

> Instead the choice was to implement the four methods as
> multiset operations.  As such, they need to correspond
> to regular set operations.

Seems to me you're trying to make one data type do the
work of two, and ending up with something inconsistent.

I think you should be providing two types: one is a
multiset, which disallows negative counts altogether;
the other behaves like a sparse vector with appropriate
arithmetic operations.

-- 
Greg



More information about the Python-list mailing list