abusing exceptions for continuations

Lautaro Pecile lautaro.pecile at gmail.com
Tue Dec 11 08:02:30 EST 2007


On Dec 10, 5:39 am, gangesmaster <tomerfil... at gmail.com> wrote:
> i've had this strange idea of using the exception's traceback (which
> holds the stack frame) to enable functional continuations, meaning,
> raise some special exception which will be caught by a reactor/
> scheduler/framework, which could later revive it by restoring the
> frame.
>
> i'm thinking of using the generator's implementation (some minimal
> support on the c-side)
>
> has this been tried before? what were the results?
>
> thanks,
> -tomer

That idea has been tried here http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/474088

It fails with algorithms which not use tail call recursion, and is
veeery slow. Try with Stackless.

Lautaro



More information about the Python-list mailing list