[issue22515] Implement partial order on Counter
Ethan Furman
report at bugs.python.org
Wed Oct 1 18:57:58 CEST 2014
Ethan Furman added the comment:
--> s1 = set([1])
--> s2 = set([1, 2])
--> s3 = set([1, 2, 3])
--> s4 = set([2])
--> s5 = set([2, 3])
--> s6 = set([3])
--> l = [s1, s2, s3, s4, s5, s6]
--> sorted(l)
[{1}, {2}, {1, 2}, {3}, {2, 3}, {1, 2, 3}]
--> s1 < s4
False
--> s4 < s2
True
--> s1 < s2
True
--> s4 < s6
False
--> l = [s1, s4]
--> sorted(l)
[{1}, {2}]
--> sorted(l)
[{1}, {2}]
Looks horribly messy to me. In the last example we can see that neither s1 nor s4 are smaller, yet s1 is consistently put first.
On the other hand, I suppose it's okay for Counter to have this behavior since it's already in sets.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22515>
_______________________________________
More information about the Python-bugs-list
mailing list