[issue40755] Add missing multiset predicates to collections.Counter

2020-05-31 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset b7d79b4f36787874128c439d38397fe95c48429b by Raymond Hettinger in branch 'master': bpo-40755: Add rich comparisons to Counter (GH-20548) https://github.com/python/cpython/commit/b7d79b4f36787874128c439d38397fe95c48429b -- __

[issue40755] Add missing multiset predicates to collections.Counter

2020-05-30 Thread Vedran Čačić
Vedran Čačić added the comment: I'm very glad for that. :-) For the other part of my message, I never intended to remove the support for non-natural counts. I just wanted to add some more methods to the natural part of Counter's API. It already has some methods which assume natural counts: .

[issue40755] Add missing multiset predicates to collections.Counter

2020-05-30 Thread Raymond Hettinger
Change by Raymond Hettinger : -- pull_requests: +19792 pull_request: https://github.com/python/cpython/pull/20548 ___ Python tracker ___ ___

[issue40755] Add missing multiset predicates to collections.Counter

2020-05-30 Thread Raymond Hettinger
Raymond Hettinger added the comment: After more thought, I've found a way to use the rich comparisons as requested. Doing so consistently required that the __eq__ method treat missing elements as having a zero count. See attached PR. -- ___ Pyth

[issue40755] Add missing multiset predicates to collections.Counter

2020-05-28 Thread Raymond Hettinger
Raymond Hettinger added the comment: I would also have preferred to use the operators <, >, <=, >=, and ==. The docs in the patch explain why we can't go down this path. Also, while counters have support for multiset operations, they continue to support other use cases a well (negative coun

[issue40755] Add missing multiset predicates to collections.Counter

2020-05-28 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 60398512c86c5535edd817c99ccb50453b3b0471 by Raymond Hettinger in branch 'master': bpo-40755: Add missing multiset operations to Counter() (GH-20339) https://github.com/python/cpython/commit/60398512c86c5535edd817c99ccb50453b3b0471 -

[issue40755] Add missing multiset predicates to collections.Counter

2020-05-25 Thread Vedran Čačić
Vedran Čačić added the comment: isequal is really strange considering we're talking about Python here. Do any of other stdlib types have that method instead of just using == (which works fine even now)? I'd even spell the second and third as <= and >=, same as set does. But if we're finally

[issue40755] Add missing multiset predicates to collections.Counter

2020-05-24 Thread Raymond Hettinger
Change by Raymond Hettinger : -- keywords: +patch pull_requests: +19623 stage: -> patch review pull_request: https://github.com/python/cpython/pull/20339 ___ Python tracker __

[issue40755] Add missing multiset predicates to collections.Counter

2020-05-24 Thread Raymond Hettinger
New submission from Raymond Hettinger : These missing predicates have been requested a number of times: isequal() issubset() issuperset() isdisjoint() -- assignee: rhettinger components: Library (Lib) messages: 369808 nosy: rhettinger priority: normal severity: normal statu