Rule proposal: require explicit strict=
argument for itertools.batched
#14387
Labels
rule
Implementing or modifying a lint rule
As of Python 3.13,
itertools.batched
has astrict
parameter that defaults toFalse
. By default, the batches might not be of the same size, which may cause subtle bugs. Whenstrict=True
, it raisesValueError
if the final batch is not the same size as the rest.This seems analogous to the existing rule
B905
which requires an explicitstrict=
parameter forzip
. Hence, I think it makes sense if there is a similar rule foritertools.batched
.I also created an issue
flake8-bugbear
which seems like a natural place for the rule given the similarity toB905
.Searched keywords:
itertools.batched
,itertools
,batched
The text was updated successfully, but these errors were encountered: