From f15408a5c1dc77320288e76e89c757b9ca836749 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Fri, 24 Apr 2020 02:33:07 -0700 Subject: [PATCH] Expand the implementation comments (GH-19699) (cherry picked from commit 4cc4d6048efcec43fe866fac96e0c2e57a87b308) Co-authored-by: Raymond Hettinger --- Lib/collections/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py index cadf1c72f08d47..a78a47c55a8fc9 100644 --- a/Lib/collections/__init__.py +++ b/Lib/collections/__init__.py @@ -695,6 +695,13 @@ def __repr__(self): # # To strip negative and zero counts, add-in an empty counter: # c += Counter() + # + # Rich comparison operators for multiset subset and superset tests + # are deliberately omitted due to semantic conflicts with the + # existing inherited dict equality method. Subset and superset + # semantics ignore zero counts and require that p≤q ∧ p≥q → p=q; + # however, that would not be the case for p=Counter(a=1, b=0) + # and q=Counter(a=1) where the dictionaries are not equal. def __add__(self, other): '''Add counts from two counters.