bpo-44558: Match countOf is/== treatment to c (GH-27007)

This commit is contained in:
Rupert Tombs 2021-07-07 14:28:09 +01:00 committed by GitHub
parent 8363c53369
commit 6bd3ecfc27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 6 deletions

View file

@ -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