diff options
author | Rupert Tombs <rupert.tombs@gmail.com> | 2021-07-07 13:28:09 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-07 13:28:09 (GMT) |
commit | 6bd3ecfc272b122b55a6adec50dd7a7c868f262f (patch) | |
tree | ad92100dff9d7506a6499f0e8fb18b74111a3e80 /Lib/operator.py | |
parent | 8363c53369a582ff9ae4e797a80cdce12624a278 (diff) | |
download | cpython-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.py | 4 |
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 |