paul rubin <phr-pythonb...@nightsong.com> added the comment:
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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40411> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com