Re: [Python-Dev] functional continuations

2007-12-16 Thread Martin v. Löwis
> yeah, i did think native functions wouldn't fit well with it, but then > again, i don't plan to have any c-side functions invoking python > callbacks. i can live with that. Just in case it isn't clear - even if you can live with it, it makes it unsuitable for inclusion into the Python interprete

Re: [Python-Dev] functional continuations

2007-12-16 Thread tomer filiba
yes, well, as i suspected and as PJE pointed out, extension or builtin functions would make life difficult, but these are difficulties i would be willing to accept. however, my attempts are futile anyways, as the evaluation stack is cleared before the exception propagates up to the frames above...

Re: [Python-Dev] functional continuations

2007-12-15 Thread Greg Ewing
By the way, I wouldn't call this a "continuation", as that word implies a bit more (reusability). It's more like a coroutine or lightweight thread. -- Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-d

Re: [Python-Dev] functional continuations

2007-12-15 Thread Greg Ewing
tomer filiba wrote: > the idea i came up with is, using exceptions for functional > continuations: after all, the exception's traceback holds the entire > context... The problem with this is that, if the call chain has passed through a C-implemented function at some point, the traceback *doesn't*

Re: [Python-Dev] functional continuations

2007-12-15 Thread Aahz
On Sat, Dec 15, 2007, tomer filiba wrote: > > i wanted to get some feedback on the issue (i tried c.l.p, but they > didn't understand me well enough): python-ideas is the best place for topics like this. -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ "Typing is che

Re: [Python-Dev] functional continuations

2007-12-15 Thread tomer filiba
yeah, i did think native functions wouldn't fit well with it, but then again, i don't plan to have any c-side functions invoking python callbacks. i can live with that. but, alas, ceval::EvalFrameEx will clear the execution stack upon returning [1], so this couldn't work anyway [2]. [1] while (STA

Re: [Python-Dev] functional continuations

2007-12-15 Thread Phillip J. Eby
At 01:04 AM 12/15/2007 -0800, tomer filiba wrote: >* do you suppose it will work? are there any drawbacks i didn't >anticipate? Yes. :) Specifically, think about what happens when a C function is in the call stack, e.g.: def f1(): return map(f2, [1,2,3]) def f2(ob): raise WaitFor(so

[Python-Dev] functional continuations

2007-12-15 Thread tomer filiba
i'm working on some minimalistic asynchronous framework for python, somewhat like twisted or stackless, but for different purposes. i came to the conclusion i want to be able to "freeze" functions, and resume them later, when some condition is matched. the idea i came up with is, using exceptions