[issue22515] Implement partial order on Counter
Ram Rachum
report at bugs.python.org
Tue Sep 30 00:30:54 CEST 2014
Ram Rachum added the comment:
Ethan, I don't understand what the problem is. I also don't understand your side note question "how does partial-ordering work for sets?" I'm not sure what you're asking.
>> That is, one counter will be considered smaller-or-equal to another if for any
>> item in the first counter, the second counter has an equal or bigger amount of
>> that item.
> According to your definition, my example should have returned True, which is clearly nonsensical.
In your example the first counter had `b` twice, while the second counter had it only once. So the result is `False`. This comes pretty directly from my definition, I'm not sure where the confusion is.
Regarding your new example: Since `Counter` works like a `defaultdict`, the second counter has a zero quantity of `b`. So the answer is again `False`.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22515>
_______________________________________
More information about the Python-bugs-list
mailing list