Title: itertools: fix count() repr to show float step 1.0 by JaceJung-dev · Pull Request #8261 · RustPython/RustPython · GitHub
Open Graph Title: itertools: fix count() repr to show float step 1.0 by JaceJung-dev · Pull Request #8261 · RustPython/RustPython
X Title: itertools: fix count() repr to show float step 1.0 by JaceJung-dev · Pull Request #8261 · RustPython/RustPython
Description: This PR follows our AI policy. Summary itertools.count()'s __repr__ omitted the step when it equalled 1, but CPython omits the step only for the integer 1 — a float step of 1.0 should still be shown. from itertools import count repr(count(10.5)) # before: 'count(10.5)' # after: 'count(10.5, 1.0)' # matches CPython CPython's count_repr skips the step only when it is a PyLong equal to 1, so a float such as 1.0 is still shown. The repr now omits the step only when it is exactly the integer 1 (checked via both the int type and value). Also unmarks test_count_with_step, which now passes. Verified locally: cargo run --release -- -m unittest -v test.test_itertools.TestBasicOps.test_count_with_step -> ok cargo run --release -- -m test test_itertools -> SUCCESS (run=137, skipped=22) Assisted-by: Claude Code:claude-opus-4-8 Summary by CodeRabbit Bug Fixes Improved the display of iterator count expressions. The step value is now omitted only when it is exactly the integer 1; other values and types remain explicitly shown for accurate representations.
Open Graph Description: This PR follows our AI policy. Summary itertools.count()'s __repr__ omitted the step when it equalled 1, but CPython omits the step only for the integer 1 — a float step of 1.0 should still be...
X Description: This PR follows our AI policy. Summary itertools.count()'s __repr__ omitted the step when it equalled 1, but CPython omits the step only for the integer 1 — a float step of 1.0 should stil...
Opengraph URL: https://github.com/RustPython/RustPython/pull/8261
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:3307bbfe-a2f0-2627-9709-7d2853fc8eb1 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | EB56:1DC30F:7464AB0:9AC8DF5:6A5E005A |
| html-safe-nonce | f695f0bb5959dd1ee295025bd789f591b558c6e987d491c21fb60b59af2ee4b9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQjU2OjFEQzMwRjo3NDY0QUIwOjlBQzhERjU6NkE1RTAwNUEiLCJ2aXNpdG9yX2lkIjoiODc0MDA1NjIyNDkwNDM4MDUwNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3711cde3a3870acf06b646ba4a00c9e7c5f6c7a765c32d9eab102165e2e94e2c |
| hovercard-subject-tag | pull_request:4038918408 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/RustPython/RustPython/pull/8261/files |
| twitter:image | https://avatars.githubusercontent.com/u/192051293?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/192051293?s=400&v=4 |
| og:image:alt | This PR follows our AI policy. Summary itertools.count()'s __repr__ omitted the step when it equalled 1, but CPython omits the step only for the integer 1 — a float step of 1.0 should still be... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7c1de870f4c0eff05971cd22970403a1239a98dc1a35e52a43594f23fc4d546f |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git |
| octolytics-dimension-user_id | 39710557 |
| octolytics-dimension-user_login | RustPython |
| octolytics-dimension-repository_id | 135201145 |
| octolytics-dimension-repository_nwo | RustPython/RustPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 135201145 |
| octolytics-dimension-repository_network_root_nwo | RustPython/RustPython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e90635d4b07e4a20ff548df2e2bfea2179c6a3f3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width