Issue10474
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2010-11-20 22:26 by SilentGhost, last changed 2022-04-11 14:57 by admin. This issue is now closed.
| Messages (5) | |||
|---|---|---|---|
| msg121799 - (view) | Author: SilentGhost (SilentGhost) * ![]() |
Date: 2010-11-20 22:26 | |
>>> a = range(5) >>> a.count(5) False >>> a.count(2) True I believe this is related to the issue9213 that introduced count and index method on the range object. According to the documentation accompanying that fix it should return an integer. |
|||
| msg121802 - (view) | Author: Benjamin Peterson (benjamin.peterson) * ![]() |
Date: 2010-11-20 22:36 | |
r86618 |
|||
| msg121803 - (view) | Author: SilentGhost (SilentGhost) * ![]() |
Date: 2010-11-20 22:39 | |
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. |
|||
| msg121806 - (view) | Author: Benjamin Peterson (benjamin.peterson) * ![]() |
Date: 2010-11-20 22:44 | |
2010/11/20 SilentGhost <report@bugs.python.org>: > > SilentGhost <michael.mischurow+bpo@gmail.com> added the comment: > > 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. Produce a case where that's true, and I'll fix it. |
|||
| msg121807 - (view) | Author: Alexander Belopolsky (belopolsky) * ![]() |
Date: 2010-11-20 22:45 | |
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. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:57:09 | admin | set | github: 54683 |
| 2010-11-20 22:45:47 | belopolsky | set | nosy:
+ belopolsky messages: + msg121807 |
| 2010-11-20 22:44:57 | benjamin.peterson | set | messages: + msg121806 |
| 2010-11-20 22:39:59 | SilentGhost | set | messages: + msg121803 |
| 2010-11-20 22:36:13 | benjamin.peterson | set | status: open -> closed |
| 2010-11-20 22:36:07 | benjamin.peterson | set | resolution: fixed messages:
+ msg121802 |
| 2010-11-20 22:35:05 | daniel.urban | set | nosy:
+ daniel.urban |
| 2010-11-20 22:26:58 | SilentGhost | create | |

