>> > I'm writing this as a complete newbie (on the issue), so don't be >> > surprised if it's the stupidest idea ever. >> >> > I was wondering if there was ever a discusision in the python >> > community on a 'raise-yield' kind-of combined expression. I'd like >> > to know if it was proposed/rejected/discussed/not-decided yet?? >> >> Recently (ok, several hours ago) I've come up to Greenlets [1] and it >> seems they implement exactly what I was asking for, in a C >> extension!! >> >> It's too bad that Python doesn't support this by default and many >> libraries won't make use of it by default. Gevent [2] for example, >> has to monkey-patch Python's socket, time.sleep and other modules so >> that things like urllib work with it. >> >> I'll continue to read now. > > Ah, if I had seen your original post I probably could have pointed you > to some good reading right away. What you've described is called a > continuation, and is natively supported by some languages (like > Scheme). It's usually not done with exceptions, though. In Scheme > it's a special form that looks like an ordinary function call, but you > can "return" from the call any number of times.
I thought they were called coroutines? Anyway, here's the Lua implementation of coroutines. It's basically a yield but it will return back several frames. http://lua-users.org/wiki/CoroutinesTutorial -- дамјан ((( http://damjan.softver.org.mk/ ))) Today we create the legacy of tomorrow. -- http://mail.python.org/mailman/listinfo/python-list