[issue40411] frozen collection.Counter

2020-05-14 Thread paul rubin
paul rubin added the comment: Note: PEP 603 may essentially take care of this, if it is accepted. -- ___ Python tracker ___ ___ Pyt

[issue40411] frozen collection.Counter

2020-04-28 Thread Kyle Stanley
Kyle Stanley added the comment: paul rubin wrote: > Yeah I think the basic answer to this ticket is "Python doesn't really have > multisets and a proposal to add them should go somewhere else". Fair > enough-- consider the request withdrawn from here. Not necessarily, python-ideas is just m

[issue40411] frozen collection.Counter

2020-04-27 Thread paul rubin
paul rubin added the comment: Totally tangential: Veky, your ordinal example would work ok in Haskell and you'd have omega work the same way as epsilon0. Take a look at Herman Ruge Jervell's book "Proof Theory" for a really nice tree-based ordinal notation that goes much higher than epsilon

[issue40411] frozen collection.Counter

2020-04-27 Thread paul rubin
paul rubin added the comment: Yeah I think the basic answer to this ticket is "Python doesn't really have multisets and a proposal to add them should go somewhere else". Fair enough-- consider the request withdrawn from here. Regarding minimalism vs completeness, regarding some feature X (s

[issue40411] frozen collection.Counter

2020-04-27 Thread Raymond Hettinger
Raymond Hettinger added the comment: If you're interested in pursuing this, please follow Kyle's suggestion and move this to Python ideas. The two frozencounter use cases presented are pretty exotic, something encountered rarely in a lifetime. That is well below the threshold for growing t

[issue40411] frozen collection.Counter

2020-04-27 Thread Kyle Stanley
Kyle Stanley added the comment: paul rubin wrote: > In that case, it works for what it is made for, so it really then is a > separate question of whether implementing multisets properly is worthwhile. Indeed, that seems to be the primary question to address. Personally, I don't have any stro

[issue40411] frozen collection.Counter

2020-04-27 Thread Vedran Čačić
Vedran Čačić added the comment: Just another usecase: one of my students is writing an implementation of ordinal arithmetic in Python as a graduate thesis. FrozenCounters whose keys are FrozenCounters and whose values are natural numbers are _exactly_ isomorphic (via Cantor's normal form) to

[issue40411] frozen collection.Counter

2020-04-27 Thread paul rubin
paul rubin added the comment: Oops I meant "*without* 100s of third party modules" in the case of ruby gems or npm. There are just a few pip modules that I really use all the time, most notably bs4. I continue to use urllib/urllib2 instead of requests because I'm used to them and because t

[issue40411] frozen collection.Counter

2020-04-27 Thread paul rubin
paul rubin added the comment: Kyle, thanks, I saw your comment after posting my own, and I looked at Raymond's mailing list post that you linked. I do think that "completing the grid" is a good thing in the cases where it's obvious how to do it (if there's one and one obvious way, then doin

[issue40411] frozen collection.Counter

2020-04-27 Thread paul rubin
paul rubin 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

[issue40411] frozen collection.Counter

2020-04-27 Thread Raymond Hettinger
Raymond Hettinger added the comment: Do you want to freeze a counter to prevent future count changes or bto make it to be hashable? Essentially the only reason we have frozenset is to use sets as dict keys to model graphs, but that wouldn't make much sense for counters. What multiset method

[issue40411] frozen collection.Counter

2020-04-27 Thread Kyle Stanley
Kyle Stanley added the comment: Also, adding Raymond to the nosy list in case he has any specific comments about a frozen collections.Counter. -- nosy: +rhettinger versions: +Python 3.9 ___ Python tracker _

[issue40411] frozen collection.Counter

2020-04-27 Thread Kyle Stanley
Kyle Stanley added the comment: Rather than starting this out as a bpo issue, I would highly recommend bringing forth a proposal for this in python-id...@python.org and explaining in as much detail as possible: 1) How a frozen variation of collection.Counter would benefit your specific use

[issue40411] frozen collection.Counter

2020-04-27 Thread paul rubin
New submission from paul rubin : It would be nice to have frozen Counters analogous to frozensets, so they are usable as dictionary keys. One can of course create frozenset(counter.items()) but that means the set items are tuples rather than the original set elements, so it's no longer quick