mirror of
https://github.com/python/cpython.git
synced 2026-05-06 04:37:33 -04:00
Minor edit: Improve comment readability and ordering (gh-136557)
This commit is contained in:
committed by
GitHub
parent
561212a033
commit
7f1e66ae0e
@@ -776,23 +776,26 @@ class Counter(dict):
|
||||
# When the multiplicities are all zero or one, multiset operations
|
||||
# are guaranteed to be equivalent to the corresponding operations
|
||||
# for regular sets.
|
||||
#
|
||||
# Given counter multisets such as:
|
||||
# cp = Counter(a=1, b=0, c=1)
|
||||
# cq = Counter(c=1, d=0, e=1)
|
||||
#
|
||||
# The corresponding regular sets would be:
|
||||
# sp = {'a', 'c'}
|
||||
# sq = {'c', 'e'}
|
||||
#
|
||||
# All of the following relations would hold:
|
||||
# set(cp + cq) == sp | sq
|
||||
# set(cp - cq) == sp - sq
|
||||
# set(cp | cq) == sp | sq
|
||||
# set(cp & cq) == sp & sq
|
||||
# (cp == cq) == (sp == sq)
|
||||
# (cp != cq) == (sp != sq)
|
||||
# (cp <= cq) == (sp <= sq)
|
||||
# (cp < cq) == (sp < sq)
|
||||
# (cp >= cq) == (sp >= sq)
|
||||
# (cp > cq) == (sp > sq)
|
||||
# set(cp + cq) == sp | sq
|
||||
# set(cp - cq) == sp - sq
|
||||
# set(cp | cq) == sp | sq
|
||||
# set(cp & cq) == sp & sq
|
||||
|
||||
def __eq__(self, other):
|
||||
'True if all counts agree. Missing counts are treated as zero.'
|
||||
|
||||
Reference in New Issue
Block a user