[Python-ideas] itertools.chunks(iterable, size, fill=None)

Simon Sapin simon.sapin at kozea.fr
Tue Jun 26 14:58:35 CEST 2012


Le 26/06/2012 14:42, Joao S. O. Bueno a écrit :
> itertools.chunks(iterable, size=None, separator=None, fill=None)
>
> Requiring at leas one of size or separator to be set?
>
> This would also work for "for x in text.split('\n')"  case.

I think that splitting an iterable on some separators or on a chunck 
size are two completely different functions. Having the same function do 
either is a bit confusing and I don’t see the benefit.

Or is there an use case in passing both parameters? What would it do 
then, end the chunck after `size` elements or at `separator`, whichever 
comes first?

Regards,
-- 
Simon Sapin





More information about the Python-ideas mailing list