[Python-ideas] Batching/grouping function for itertools

Serhiy Storchaka storchaka at gmail.com
Sun Dec 8 12:30:56 CET 2013


08.12.13 11:25, Steven D'Aprano написав(ла):
> In the second case, there is a question about what to do with sequences
> that are not a multiple of the window size. Similar to zip(), there are
> two things one might do:
>
> - pad with some given object;
> - raise an exception

3) emit last chunk incompleted;
4) skip incomplete chunk.

There is also a question about result's type. Sometimes you need an 
iterator of subsequences (i.e. split string on equal string chunks), 
sometimes an iterator of iterators is enough.

I.e. at least 8 variants are needed.



More information about the Python-ideas mailing list