[Python-Dev] Minimal 'stackless' PEP using generators?

Phillip J. Eby pje at telecommunity.com
Mon Aug 23 22:16:08 CEST 2004


At 03:41 PM 8/23/04 -0400, Clark C. Evans wrote:
>(off list)
>
>On Mon, Aug 23, 2004 at 03:34:13PM -0400, Phillip J. Eby wrote:
>| >Yes.  The idea is for Python to maintain a stack of generators, and when
>| >ever the top-most generator yields <magic> this yield skips the
>| >intermediate generators on the stack, and goes immediately to the
>| >calling function.
>|
>| That's not the part I mean.  I'm talking about *after* that happens, when
>| you *resume* the generators, and you'll need to reconstruct the stack as
>| it stood when the generators were interrupted.
>
>Yes.  The entire generator stack would have to be put back into play.

Right, but you haven't offered any proposal for where this stack will come 
from, how it will actually work, etc.

I personally don't see any way to implement your approach in CPython that 
doesn't essentially require re-implementing a portion of 'peak.events' in 
C, while adding the overhead of the control value check to *every* 
generator .next() operation, even in programs that don't use the feature.



More information about the Python-Dev mailing list