Why chunks is not part of the python standard lib?

Ricardo Azpeitia Pimentel razpeitia at gmail.com
Wed May 1 02:26:06 EDT 2013


After reading How do you split a list into evenly sized chunks in
Python?<http://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-evenly-sized-chunks-in-python>
 and seeing this kind of mistakes happening
https://code.djangoproject.com/ticket/18972 all the time.

Why is not a chunks function in itertools?

grouper from http://docs.python.org/2/library/itertools.html#recipes doesn't
have the same behavior as chunks

Example:

chunks([1, 2, 3, 4, 5], 3)# Should return [[1, 2, 3], [4, 5]] or the
iterator equivalent.

Original Post on StackOverflow:
http://stackoverflow.com/questions/16313008/why-chunks-is-not-part-of-the-python-standard-lib
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130501/852998ec/attachment.html>


More information about the Python-list mailing list