mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
[3.9] bpo-44558: Match countOf is
/==
treatment to c (GH-27007). (GH-27055)
This commit is contained in:
parent
324b93295f
commit
9761abf306
5 changed files with 13 additions and 6 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue