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

Georg Brandl g.brandl at gmx.net
Tue Jun 26 10:39:04 CEST 2012

On 26.06.2012 10:03, anatoly techtonik wrote:
> Now that Python 3 is all about iterators (which is a user killer
> feature for Python according to StackOverflow -
> http://stackoverflow.com/questions/tagged/python) would it be nice to
> introduce more first class functions to work with them? One function
> to be exact to split string into chunks.
>      itertools.chunks(iterable, size, fill=None)
> Which is the 33th most voted Python question on SO -
> http://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-evenly-sized-chunks-in-python/312464

+1.  This is already a recipe in the itertools docs
(see grouper() on http://docs.python.org/library/itertools#recipes),
but it is so often requested (and used) that it is a very good
candidate for a stdlib function.


More information about the Python-ideas mailing list