Message228088
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. |
|
Date |
User |
Action |
Args |
2014-10-01 16:59:27 | steven.daprano | set | recipients:
+ steven.daprano, rhettinger, pitrou, eric.smith, r.david.murray, cool-RR, ethan.furman, serhiy.storchaka, josh.r |
2014-10-01 16:59:27 | steven.daprano | link | issue22515 messages |
2014-10-01 16:59:26 | steven.daprano | create | |
|