Message367488
Yes, the idea was for them to be hashable, to be used as dict keys. E.g. if you use frozensets to model graphs, you'd use frozen multisets for hypergraphs. My immediate use case involved word puzzles, e.g. treating words as bags of scrabble tiles with letters on them, and finding out what other words you could form from the letters. It is not a pressing need.
I'm trying to remember what the other missing operation I ran into was, a few days ago. It may have been subset. I found a workaround but it seemed a bit ugly. It would be nice if Counters could also be thought of as multisets which can do the same things sets can do with unneeded head scratching. It seems like counters and multisets/bags really are different things conceptually. Their operations and implementations overlap, but they are different. E.g. it can make sense for a counter to have a negative count of something, but not for a bag. |
|
Date |
User |
Action |
Args |
2020-04-28 03:35:19 | phr | set | recipients:
+ phr, rhettinger, aeros |
2020-04-28 03:35:19 | phr | set | messageid: <1588044919.37.0.564324477071.issue40411@roundup.psfhosted.org> |
2020-04-28 03:35:19 | phr | link | issue40411 messages |
2020-04-28 03:35:18 | phr | create | |
|