itertools question

Chris Rebert clp2 at rebertia.com
Thu May 14 12:00:44 EDT 2009


On Thu, May 14, 2009 at 8:53 AM, Ned Deily <nad at acm.org> wrote:
> In article <guh5qc$lsc$1 at ger.gmane.org>,
>  Neal Becker <ndbecker2 at gmail.com> wrote:
>> Is there any canned iterator adaptor that will
>>
>> transform:
>> in = [1,2,3....]
>>
>> into:
>> out = [(1,2,3,4), (5,6,7,8),...]
>>
>> That is, each time next() is called, a tuple of the next N items is
>> returned.
>
> This topic was discussed here just a few days ago:
>
> <http://comments.gmane.org/gmane.comp.python.general/622763>

They really should just add grouper() to itertools rather than leaving
it as a recipe. People keep asking for it so often...

Cheers,
Chris
-- 
http://blog.rebertia.com



More information about the Python-list mailing list