[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

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

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

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 cheap.

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 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