On Sat, 22 Nov 2014 07:47:51 -0800
Raymond Hettinger
On Nov 21, 2014, at 3:55 PM, Antony Lee
wrote: As Counter objects effectively behave like multi-sets, it seems reasonable to overload <, <=, >, >= as for set objects to check whether a Counter is a sub/super-set of another Counter:
c < d <===> all(c[k] < d[k] for k in c)
Thoughts
This is something that could be done, but I think the demonstrated need is nearly zero. It doesn't seem to arise in practice.
You say this while you closed an issue where the poster asked for this very feature, and clearly stated what his needs were: http://bugs.python.org/issue22515
Conceptually, a counter is just a dictionary that returns zero instead of raising a KeyError.
Come on. If that were the case, it wouldn't expose other operators such as addition, subtraction, intersection and union. https://docs.python.org/3.3/library/collections.html#collections.Counter
So, while they can be used as multisets, they have other uses as well (for example, allowing negative counts or fractional counts).
The demonstrated need for those "other uses" is nearly zero. It doesn't seem to arise in practice. Your insistance on defending irrational API decisions is staggering. Regards Antoine.