stackless python

Christian Tismer tismer at
Sat Aug 3 21:48:15 EDT 2002

holger krekel wrote:
> Christian Tismer wrote:
>>Neil Schemenauer wrote:
>>>François Pinard wrote:
>>>>(My main question, maybe already answered in there -- I did not check yet
>>>>-- is how one proceeds to `yield' from within a nest of function calls,
>>>>and to later kludge resuming the function nesting sequence on `.next()'.)
>>>You can't since only one stack frame is saved per generator.  That's why
>>>one of the reasons they are called simple generators (two others being
>>>ease of implementation and of understanding).  You probably want to look
>>>at stackless Python if you haven't already.
>>Btw., thanks for the generators! They made it quite easy for me to
>>create a "runnable frame" without having to deal with paramters
>>and such. Just create a temporary generator and peel the frame off :-)
>>With the restriction of "pure python only", that means no method
>>calls, no cfunctions ...
> I can't see where you draw the line.  Obviously (c)functions are called 
> even for a 'str' call. Heck, anything calls something. Where do you
> draw the line? 

Hallo Holger :-)

there is a simple interface to generators, which are completely
pyfunction based. Allowing a generator to return "runnable"
has been a very small, single change to the interpreter.
What I mean is that it is easy to support this king of freedom
in a slightly extended manner, by making pyfunction calls

All the other stuff is much much harder. But a patch for this one
would cost me two hours.

There wasn't anything else to claim that I thing this would be cheap,
and make the generators "full generators", as far as only pyfunction
calls are involved.

tia - chris

Christian Tismer             :^)   <mailto:tismer at>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship*
14109 Berlin                 :     PGP key ->
work +49 30 89 09 53 34  home +49 30 802 86 56  pager +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?

More information about the Python-list mailing list