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

Tal Einat taleinat at gmail.com
Tue Jun 26 12:34:54 CEST 2012

On Tue, Jun 26, 2012 at 11:03 AM, anatoly techtonik <techtonik at gmail.com> 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


When working with iterators I have needed this often, and have
implemented a similar utility function in many projects. As an
example, this is a basic building block in my RunnincCalcs[1] module.

- Tal Einat

[1] http://bitbucket.org/taleinat/runningcalcs/src/5bf8816d944b/RunningCalcs.py#cl-38

More information about the Python-ideas mailing list