[Python-checkins] Expand the implementation comments (GH-19699) (GH-19701)

Miss Islington (bot) webhook-mailer at python.org
Fri Apr 24 06:04:46 EDT 2020


https://github.com/python/cpython/commit/c7b55e929b35ccab552f9efd49eed4a168e97e2f
commit: c7b55e929b35ccab552f9efd49eed4a168e97e2f
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2020-04-24T03:04:41-07:00
summary:

Expand the implementation comments (GH-19699) (GH-19701)

files:
M Lib/collections/__init__.py

diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py
index cadf1c72f08d4..a78a47c55a8fc 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.



More information about the Python-checkins mailing list