[issue22515] Implement partial order on Counter

Ram Rachum report at bugs.python.org
Sat Oct 4 17:54:18 CEST 2014


Ram Rachum added the comment:

Hi everybody,

I agree we have a mess on our hands, with lots of cases where comparison is weird. To be honest I've given up on `collections.Counter` at this point. The fact that it's a "hybrid mapping/multiset" is the cause of all the problems, so I just made my own class that is defined as a multiset with only positive integer values, and I'm going to use that and define methods on it without having to worry about these weird cases. Unless someone else wants to champion this issue and resolve the edge cases, it can be closed as far as I'm concerned.

I really wish that `collections.Counter` wouldn't have been added to the standard library as a "hybrid mapping/multiset"; I think that it shows emphasis on the implementation rather than the usage, while the usage is more important. But there's nothing I can do about that. (If there was a place where we can make notes for Python 4, I'd put a note there about it.)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22515>
_______________________________________


More information about the Python-bugs-list mailing list