Making sense of Stackless

Christian Tismer tismer at tismer.com
Thu Mar 9 23:07:27 CET 2000


Darrell wrote:
...
> It would be nice if I could do this.
> 
> def classIterator(seq):
>     offset= -1
>     return continuation.current(1)
>     offset=offset+1
>     return seq[offset]
> 
> The parm into current indicates I want the continuation to point just past
> this point.

This is included into continuations 0.8 which are about to be
published. It is even easier: Whatever I can express as a
function avoids to have to juggle with opcodes.
Here we go:

continuation.return_current()

Does exactly what we need: Return ourself and be in position
to be called again.

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer at appliedbiometrics.com>
Applied Biometrics GmbH      :     Have a break! Take a ride on Python's
Kaunstr. 26                  :    *Starship* http://starship.python.net
14163 Berlin                 :     PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     we're tired of banana software - shipped green, ripens at home




More information about the Python-list mailing list