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
range.count returns boolean #54683
Comments
>>> a = range(5)
>>> a.count(5)
False
>>> a.count(2)
True I believe this is related to the bpo-9213 that introduced count and index method on the range object. According to the documentation accompanying that fix it should return an integer. |
r86618 |
Benjamin, the docs say that it's possible to have count more than 1, depending on comparison rules. If that's the case, I'm afraid your solution might need to be adjusted. |
2010/11/20 SilentGhost <report@bugs.python.org>:
Produce a case where that's true, and I'll fix it. |
SilentGhost, Benjamin's fix only affect the optimized path when the argument is int or bool. Exotic comparison rules are handled in the else clause. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: