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 pitrou
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.15:39:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In-reply-to <>
Le 04/10/2014 17:24, Steven D'Aprano a écrit :
> I know that in general discussions do not need a PEP, but we seem to be 
> rushing awfully fast into writing code before we even know what the code 
> is supposed to do.

Writing a patch is useful practice because it's a way to discover latent
problems (especially when writing unit tests).

> py> Counter(a=1, b=0) < Counter(a=2)
> True
> py> Counter(a=1, b=0) <= Counter(a=2)
> False

That looks wrong to me.

> py> Counter(a=0) <= Counter(b=0)
> True
> py> (Counter(a=0) < Counter(b=0)) or (Counter(a=0) == Counter(b=0))
> False


> py> Counter(a=0) < Counter(b=0)
> False
> py> Counter(a=0) < Counter(b=0, c=0)
> True


> I'm not convinced that mixed Counter and regular dict comparisons should 
> be supported, but Ram's patch supports any Mapping type. Is that a good 
> idea? There's been no discussion on that question.

That sounds wrong to me as well.

> Can somebody explain to me what this means? How is this meaningfully a 
> subset operation?
> py> Counter(a="eggs") < Counter(a="spam")
> True

I agree this looks silly. However, the Counter doc says:

"""The multiset methods are designed only for use cases with positive
values. [...] There are no type restrictions, but the value type needs
to support addition, subtraction, and comparison."""

Which really sounds like an excuse to not perform any type checking and
silently allow nonsensical multiset behaviour with non-integer keys. We
can follow that lead :-)
Date User Action Args
2014-10-04 15:39:04pitrousetrecipients: + pitrou, rhettinger, mark.dickinson, scoder, eric.smith, steven.daprano, r.david.murray, cool-RR, ethan.furman, serhiy.storchaka, Saimadhav.Heblikar, josh.r
2014-10-04 15:39:04pitroulinkissue22515 messages
2014-10-04 15:39:04pitroucreate