summaryrefslogtreecommitdiffstats
path: root/Lib/collections
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2020-04-24 09:33:07 (GMT)
committerGitHub <noreply@github.com>2020-04-24 09:33:07 (GMT)
commit4cc4d6048efcec43fe866fac96e0c2e57a87b308 (patch)
tree15af111c5eb25228b4cf24ae4b329a98c65498e2 /Lib/collections
parent25104949a5a60ff86c10691e184ce2ecb500159b (diff)
downloadcpython-4cc4d6048efcec43fe866fac96e0c2e57a87b308.zip
cpython-4cc4d6048efcec43fe866fac96e0c2e57a87b308.tar.gz
cpython-4cc4d6048efcec43fe866fac96e0c2e57a87b308.tar.bz2
Expand the implementation comments (GH-19699)
Diffstat (limited to 'Lib/collections')
-rw-r--r--Lib/collections/__init__.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py
index bb9a605..c4bff59 100644
--- a/Lib/collections/__init__.py
+++ b/Lib/collections/__init__.py
@@ -711,6 +711,13 @@ class Counter(dict):
#
# 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.