Re: [Python-ideas] itertools.chunks(iterable, size, fill=None)
On 29 June 2012 05:55, Michele Lacchia <michelelacchia@gmail.com> wrote:
+ 1 for the original proposal! I don't think splitting belongs to potential itertools.chunks
Il giorno martedì 26 giugno 2012 14:58:35 UTC+2, Simon Sapin ha scritto:
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?
Indeed - these are orthogonal features - but I think the ability to split on a separator as an interator, if not as important as chunks, is missing as well. Maybe add both? js -><-
Regards, -- Simon Sapin
_______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas
participants (1)
-
Joao S. O. Bueno