[Python-ideas] Batching/grouping function for itertools
Chris Angelico
rosuav at gmail.com
Sun Dec 8 16:22:49 CET 2013
On Mon, Dec 9, 2013 at 2:13 AM, Ron Adam <ron3200 at gmail.com> wrote:
> How about 2 lower level building blocks that would make these things easier
> to make and think about.
>
>
> Possibly function to take the next n items of an iterator without advancing
> it.
Fundamentally impossible. Here's a function that returns an iterator:
def d20():
import random
while True:
yield random.randrange(1,21)
dice_roller = d20()
How are you going to take the next n items from dice_roller without
advancing it?
ChrisA
More information about the Python-ideas
mailing list