Steven D'Aprano added the comment: Ethan said:
> If it is so specialized as to only be needed in complex combinatorial > calculations, does it belong in the general-purpose part of the > language? It's a multi-set, a general purpose and fairly fundamental data type. https://en.wikipedia.org/wiki/Set_%28abstract_data_type%29#Multiset And later: > Curiousity question: What happens if you try to sort a list of > partially ordered Counters? The same thing that happens when you sort a list of any partially ordered objects, such as sets: py> sorted([{1, 2, 3, 4}, {2, 4}, {1, 3}, {2, 3, 4}, {1, 2, 3}]) [{2, 4}, {1, 3}, {2, 3, 4}, {1, 2, 3}, {1, 2, 3, 4}] You get some order, but since sorting assumes a total order, not just partial order, the result isn't really meaningful, and will very likely depend on the initial order of the items. If that worries you, then don't sort items that implement only a partial order. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22515> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com