getting n items at a time from a generator
Terry Jones
terry at jon.es
Thu Dec 27 07:24:51 EST 2007
More information about the Python-list mailing list
Thu Dec 27 07:24:51 EST 2007
- Previous message (by thread): getting n items at a time from a generator
- Next message (by thread): getting n items at a time from a generator
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>>>>> "Kugutsumen" == Kugutsumen <kugutsumen at gmail.com> writes: Kugutsumen> On Dec 27, 7:07 pm, Paul Hankin <paul.han... at gmail.com> wrote: >> On Dec 27, 11:34 am, Kugutsumen <kugutsu... at gmail.com> wrote: >> >> > I am relatively new the python language and I am afraid to be missing >> > some clever construct or built-in way equivalent to my 'chunk' >> > generator below. Kugutsumen> Thanks, I am going to take a look at itertools. I prefer the Kugutsumen> list version since I need to buffer that chunk in memory at Kugutsumen> this point. Also consider this solution from O'Reilly's Python Cookbook (2nd Ed.) p705 def chop(iterable, length=2): return izip(*(iter(iterable),) * length) Terry
- Previous message (by thread): getting n items at a time from a generator
- Next message (by thread): getting n items at a time from a generator
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list