Skip to content
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

Simplify stdlib code by using itertools.batched() #126317

Open
lgeiger opened this issue Nov 1, 2024 · 1 comment
Open

Simplify stdlib code by using itertools.batched() #126317

lgeiger opened this issue Nov 1, 2024 · 1 comment
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@lgeiger
Copy link

lgeiger commented Nov 1, 2024

#98364 introduced itertools.batched() but since it's pretty new it's still rarely used inside the standard library.

pickle.py includes a custom version multiple times which all could be replaced by itertools.batched() for improved readability.
This probably has a negligible performance impact (at the very least it won't be slower) but should make the code easier to understand.

Let me know if you're interested in a contribution for this or whether you'd rather not have the extra churn for a minor change like this.

@picnixz picnixz added type-feature A feature request or enhancement stdlib Python modules in the Lib dir labels Nov 2, 2024
@picnixz
Copy link
Contributor

picnixz commented Nov 2, 2024

I'm not sure we want to refactor pickle.py, especially not the pure Python implementation. But I'll let this decision fall to @serhiy-storchaka.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement
Projects
Status: No status
Development

No branches or pull requests

2 participants