This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients Saimadhav.Heblikar, cool-RR, eric.smith, ethan.furman, josh.r, mark.dickinson, pitrou, r.david.murray, rhettinger, scoder, serhiy.storchaka, steven.daprano
Date 2014-10-04.10:13:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <20141004101319.GI19757@ando.pearwood.info>
In-reply-to <1412411897.59.0.168847034586.issue22515@psf.upfronthosting.co.za>
Content
On Sat, Oct 04, 2014 at 08:38:17AM +0000, Ram Rachum wrote:
> 
> Ram Rachum added the comment:
> 
> > There are some properties of set comparison:
> > 
> > (a < b) == (a <= b and a != b)
> 
> I don't think so, because counter equality is based on dict equality so it doesn't ignore zero values.

That's a very good point! That suggests that we shouldn't treat Counters 
as multisets (a.k.a. bags) and define subset/superset operators. They're 
*almost* multisets, but not quite the same, since:

Counter({'a': 0}) != Counter({})

but the formal definition of multiset suggests those should be equal:

https://en.wikipedia.org/wiki/Multiset#Formal_definition

Perhaps we should rethink this. I'm starting to wonder whether we need a 
PEP to define exactly how subset and superset should be defined for 
Counters. This is precisely the trouble with rushing to add code before 
we know what the code is supposed to do... :-)
History
Date User Action Args
2014-10-04 10:13:25steven.dapranosetrecipients: + steven.daprano, rhettinger, mark.dickinson, pitrou, scoder, eric.smith, r.david.murray, cool-RR, ethan.furman, serhiy.storchaka, Saimadhav.Heblikar, josh.r
2014-10-04 10:13:25steven.dapranolinkissue22515 messages
2014-10-04 10:13:25steven.dapranocreate