On Jun 30, 12:13 am, Дамјан Георгиевски <gdam...@gmail.com> wrote: > > 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. A while back, Stackless Python supported continuations, but it was removed because (IIRC) it made stackless too platform-dependent (plus there wasn't much interest). Carl Banks -- http://mail.python.org/mailman/listinfo/python-list