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:8f165ff6-c6cd-a592-5648-6d417b058372 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | E3E6:1425CF:32F10B:43F505:6A5E726E |
| html-safe-nonce | 3a86ed017f7a4a3c8e38af8327929ccdfaa34134b612070f35e815588c201bfa |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFM0U2OjE0MjVDRjozMkYxMEI6NDNGNTA1OjZBNUU3MjZFIiwidmlzaXRvcl9pZCI6IjM1OTMyMjI4MTc2MDgyNjYzNTAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c733d2047635e050b3074dc4f740012b4e13b1c813da96984de309ca4e8478a9 |
| 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 | 71950bbe6bf7e15662b868c102fed9d1682c29a05970d9b2daa2e4dd3522c52e |
| 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 | 7514606601325843bc1c464d2d8bf5fe9af2c154 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width