[3.9] bpo-44558: Match countOf is/== treatment to c (GH-27007). (GH-27055)

This commit is contained in:
Dong-hee Na 2021-07-07 23:55:22 +09:00 committed by GitHub
parent 324b93295f
commit 9761abf306
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