Skip to content

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

Closed
@lgeiger

Description

@lgeiger

#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.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtype-featureA feature request or enhancement

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions