[Python-ideas] Batching/grouping function for itertools
Chris Angelico
rosuav at gmail.com
Sun Dec 8 16:40:30 CET 2013
On Mon, Dec 9, 2013 at 2:34 AM, Stephen J. Turnbull <stephen at xemacs.org> wrote:
> Chris Angelico writes:
>
> > How are you going to take the next n items from dice_roller without
> > advancing it?
>
> Memoize.
That's not a building-block then, that's a quite separate feature. In
this particular instance there's no way to distinguish between
"predict the next three but don't advance the iterator" and "advance
the iterator by three and then rewind it the same distance", but
imagine an iterators that blocks for input, or something. You don't
want a purportedly low-level function (from which you derive the more
"usable" functions) doing memoization on that.
ChrisA
More information about the Python-ideas
mailing list