Issue 28296: Add le and ge to collections.Counter (original) (raw)
I would really like there to be comparison operators for collection.Counter similar to the ones for sets. While you can now use minus to some degree for that comparison, it is very inefficient. I have attached an implementation of ge and le as a patch. I could also provide the necessary additions to the documentation, if that is desired.
Oh, I should have searched properly before creating this ticket. Sorry about that. I guess I will be subclassing Counter in my project then, to get this functionality... Only problem is, that when using the builtin add etc. of my Counter subclass, I will get a Counter instance, that does not support ordering... So I guess I will not use it at all.