Skip to content

Commit c7b55e9

Browse files
Expand the implementation comments (GH-19699) (GH-19701)
1 parent d9df63d commit c7b55e9

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
@@ -695,6 +695,13 @@ def __repr__(self):
695695
#
696696
# To strip negative and zero counts, add-in an empty counter:
697697
# c += Counter()
698+
#
699+
# Rich comparison operators for multiset subset and superset tests
700+
# are deliberately omitted due to semantic conflicts with the
701+
# existing inherited dict equality method. Subset and superset
702+
# semantics ignore zero counts and require that p≤q ∧ p≥q → p=q;
703+
# however, that would not be the case for p=Counter(a=1, b=0)
704+
# and q=Counter(a=1) where the dictionaries are not equal.
698705

699706
def __add__(self, other):
700707
'''Add counts from two counters.

0 commit comments

Comments
 (0)