Ezio Melotti added the comment: FWIW I'm +1 about adding grouper(), since it happened to me to use it and suggest more often than any other recipe (I think it's the only recipe I used/know), and even more often than some of the current itertools. The fact that has been requested several times already it's a good indication that it's something useful, and not a feature creep (I don't think any other recipe received nearly as many requests).
Regarding use cases, a few days ago I needed it while shuffling a sequence of 20 chars and then split it in four 5-chars long groups. I also remember writing code like this more than once: >>> s = 'aaaaabbbbbcccccddddd' >>> n = 5 >>> [s[x:x+n] for x in range(0,len(s),n)] ['aaaaa', 'bbbbb', 'ccccc', 'ddddd'] (As a side note, I find the grouper(iterable, n, fill) signature more intuitive than grouper(n, iterable, fill) (the recipe uses the latter).) ---------- assignee: rhettinger -> nosy: +ezio.melotti stage: -> needs patch type: -> enhancement _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue17862> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com