stackless python

Christian Tismer tismer at tismer.com
Sat Aug 3 13:25:26 EDT 2002


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, it would be quite doable to extend your
yield to nested frames, if we invent a non-recursive version
of call_function. Your generators would then be lists of frames.

I'd like this feature as well, since such frames would be rather
easy to pickle, which turns out to be almost impossible with
my strong-arm stack switching stuff. I'd still like to slowly
move Python to avoid recursions step by step, and my approach
would only be used when necessary.

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer at tismer.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
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?   http://www.stackless.com/






More information about the Python-list mailing list