Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4cc4d60

Browse files
authored
Expand the implementation comments (GH-19699)
1 parent 2510494 commit 4cc4d60

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Lib/collections/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,13 @@ def __repr__(self):
711711
#
712712
# To strip negative and zero counts, add-in an empty counter:
713713
# c += Counter()
714+
#
715+
# Rich comparison operators for multiset subset and superset tests
716+
# are deliberately omitted due to semantic conflicts with the
717+
# existing inherited dict equality method. Subset and superset
718+
# semantics ignore zero counts and require that p≤q ∧ p≥q → p=q;
719+
# however, that would not be the case for p=Counter(a=1, b=0)
720+
# and q=Counter(a=1) where the dictionaries are not equal.
714721

715722
def __add__(self, other):
716723
'''Add counts from two counters.

0 commit comments

Comments
 (0)