[Python-Dev] uthread strawman
Christian Tismer
tismer@tismer.com
Thu, 09 Nov 2000 15:26:17 +0200
Moshe Zadka wrote:
>
> On Thu, 9 Nov 2000, Christian Tismer wrote:
>
> > Does anybody know of a useful example where continuations
> > are really needed?
>
> Well, it may be a bit unpythonic (for several reasons), but restartable
> exceptions AFAICS cannot be implemented by generators or coroutines.
> Restartable exceptions are not always appropriate, but tend to be
> a pain to simulate when they are needed.
(sorry for posting to python-dev/null but Starship is still down)
How would restartable exceptions work? Like so?
try: # here, a continuation is saved
pass # some operations which may fail,
# raising something that inherits from RestartableException
except RestartableException:
pass # repair the condition
sys.try_again() # go back to the try statement
Probably not, since this would be doable by just an internal
jump operation.
But if the restartable exception were a callable object,
continuations might be necessary, since we now have a fork
of two concurrently existing execution paths in the frame:
We might continue with the exception handling but pass the
restartable to someone else, who tries to call it later.
cheers - chris
--
Christian Tismer :^) <mailto:tismer@tismer.com>
Mission Impossible 5oftware : 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
where do you want to jump today? http://www.stackless.com