Skip to content

str.count annotation is missing optional parameters. #1108

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

Closed
gwk opened this issue Mar 28, 2017 · 2 comments · Fixed by #1109
Closed

str.count annotation is missing optional parameters. #1108

gwk opened this issue Mar 28, 2017 · 2 comments · Fixed by #1109

Comments

@gwk
Copy link
Contributor

gwk commented Mar 28, 2017

s = "abc"
c = s.count('b', 0, 0) # x.py:2:4: error: Too many arguments for "count" of "str"

The code is valid; the error is spurious. As discussed in PR #1107, it appears that fixing this is a bit complex due to the type definition of Sequence.count.

@gwk
Copy link
Contributor Author

gwk commented Mar 28, 2017

@gvanrossum @JelleZijlstra I think I made a mistake in my earlier exploration of the problem. Simply changing the annotation of str.count appears to work, contrary to what I said earlier. Working on a new PR now.

@gvanrossum
Copy link
Member

Glad you figured it out. Looking forward to the new PR. You can close the old one yourself.

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 a pull request may close this issue.

2 participants