[issue6021] itertools.grouper

2012-06-29 Thread Eric Snow
Changes by Eric Snow : -- nosy: +eric.snow ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.or

[issue6021] itertools.grouper

2009-05-14 Thread Chris Rebert
Changes by Chris Rebert : -- nosy: +cvrebert ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue6021] itertools.grouper

2009-05-14 Thread Raymond Hettinger
Raymond Hettinger added the comment: > All implementations relying on zip or zip_longest breaks > with infinite iterable (e.g. itertools.count()). How is it broken? Infinite in, infinite out. >>> def grouper(n, iterable, fillvalue=None): ...args = [iter(iterable)] * n ...return zip_

[issue6021] itertools.grouper

2009-05-14 Thread Lie Ryan
Lie Ryan added the comment: All implementations relying on zip or zip_longest breaks with infinite iterable (e.g. itertools.count()). And it is not impossible to define a clean, flexible, and familiar API which will be similar to open()'s mode or unicode error mode. The modes would be 'error' (

[issue6021] itertools.grouper

2009-05-14 Thread Raymond Hettinger
Raymond Hettinger added the comment: This has been rejected before. * It is not a fundamental itertool primitive. The recipes section in the docs shows a clean, fast implementation derived from zip_longest(). * There is some debate on a correct API for odd lengths. Some people want an exc

[issue6021] itertools.grouper

2009-05-14 Thread Lie Ryan
New submission from Lie Ryan : An itertool to Group-by-n >>> lst = range(15) >>> itertools.grouper(lst, 5) [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9], [10, 11, 12, 13, 14]] This function is often asked in several c.l.py discussions, such as these: http://comments.gmane.org/gmane.comp.python.general/62