summaryrefslogtreecommitdiffstats
path: root/Lib/operator.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-07-07 13:50:41 (GMT)
committerGitHub <noreply@github.com>2021-07-07 13:50:41 (GMT)
commit9f431dd0a59c9ac2de46772a4dbd7db2199ef26a (patch)
treec3918291c70dbdc58ed89c8f140256352453f955 /Lib/operator.py
parent645e527298b1f24625783338076330037d860162 (diff)
downloadcpython-9f431dd0a59c9ac2de46772a4dbd7db2199ef26a.zip
cpython-9f431dd0a59c9ac2de46772a4dbd7db2199ef26a.tar.gz
cpython-9f431dd0a59c9ac2de46772a4dbd7db2199ef26a.tar.bz2
bpo-44558: Match countOf `is`/`==` treatment to c (GH-27007)
(cherry picked from commit 6bd3ecfc272b122b55a6adec50dd7a7c868f262f) Co-authored-by: Rupert Tombs <rupert.tombs@gmail.com>
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