mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
bpo-44558: Match countOf is
/==
treatment to c (GH-27007)
This commit is contained in:
parent
8363c53369
commit
6bd3ecfc27
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