#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
#98364 introduced
itertools.batched()but since it's pretty new it's still rarely used inside the standard library.pickle.pyincludes a custom version multiple times which all could be replaced byitertools.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