summaryrefslogtreecommitdiffstats
path: root/Lib/operator.py
diff options
context:
space:
mode:
authorRupert Tombs <rupert.tombs@gmail.com>2021-07-07 13:28:09 (GMT)
committerGitHub <noreply@github.com>2021-07-07 13:28:09 (GMT)
commit6bd3ecfc272b122b55a6adec50dd7a7c868f262f (patch)
treead92100dff9d7506a6499f0e8fb18b74111a3e80 /Lib/operator.py
parent8363c53369a582ff9ae4e797a80cdce12624a278 (diff)
downloadcpython-6bd3ecfc272b122b55a6adec50dd7a7c868f262f.zip
cpython-6bd3ecfc272b122b55a6adec50dd7a7c868f262f.tar.gz
cpython-6bd3ecfc272b122b55a6adec50dd7a7c868f262f.tar.bz2
bpo-44558: Match countOf `is`/`==` treatment to c (GH-27007)
Diffstat (limited to 'Lib/operator.py')
-rw-r--r--Lib/operator.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/operator.py b/Lib/operator.py
index 6782703..241fdbb 100644
--- a/Lib/operator.py
+++ b/Lib/operator.py
@@ -155,10 +155,10 @@ def contains(a, b):
return b in a
def countOf(a, b):
- "Return the number of times b occurs in a."
+ "Return the number of items in a which are, or which equal, b."
count = 0
for i in a:
- if i == b:
+ if i is b or i == b:
count += 1
return count