proposed PEP: iterator splicing

Kay Schluehr kay.schluehr at gmx.net
Sun Apr 15 16:02:22 CEST 2007


On Apr 15, 10:23 am, Anton Vredegoor <anton.vredeg... at gmail.com>
wrote:

> I'm currently also fascinated by the new generator possibilities, for
> example sending back a value to the generator by making yield return a
> value. What I would like to use it for is when I have a very long
> generator and I need just a slice of the values. That would mean running
> through a loop, discarding all the values until the generator is in the
> desired state and only then start doing something with the output.
> Instead I would like to directly set or 'wind' -like a file- a generator
> into some specific state.

Maybe you should start by developing a design pattern first and
publish it in the Cookbook. I have the fuzzy impression that the idea
you are after, requires more powerfull control structures such as
delimited continuations that are beyond ths scope of Pythons simple
coroutines.

Kay




More information about the Python-list mailing list