Skip to content

str.count only takes positional args #11503

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 29, 2024
Merged

str.count only takes positional args #11503

merged 1 commit into from
Feb 29, 2024

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Feb 29, 2024

>>> ''.count(x='a')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: str.count() takes no keyword arguments
PyDoc_STRVAR(count__doc__,
             "S.count(sub[, start[, end]]) -> int\n\
\n\
Return the number of non-overlapping occurrences of substring sub in\n\
string S[start:end].  Optional arguments start and end are\n\
interpreted as in slice notation.");

```
>>> ''.count(x='a')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: str.count() takes no keyword arguments
```
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@sobolevn sobolevn merged commit 19d1b68 into main Feb 29, 2024
@sobolevn sobolevn deleted the sobolevn-patch-3 branch February 29, 2024 07:37
danieleades pushed a commit to danieleades/typeshed that referenced this pull request Mar 1, 2024
```
>>> ''.count(x='a')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: str.count() takes no keyword arguments
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants