Re: Proposal for adding Shallow Threads and a Main Loop to Python

2005-03-18 Thread Diez B. Roggisch
Hi, a few questions: A shallow thread is just a generator modified in the most obvious way possible. The yield statement is replaced with a waitfor expression. You give it the object you wish to wait for. Then when it's ready you get back a return value or an exception. These waitfor

Proposal for adding Shallow Threads and a Main Loop to Python

2005-03-17 Thread Rhamphoryncus
First a bit about myself. I've been programming in python several years now, and I've got several more years before that with C. I've got a lot of interest in the more theoretical stuff (language design, component architectures, etc). Of late my focus has been on concurrent operations (and on

Re: Proposal for adding Shallow Threads and a Main Loop to Python

2005-03-17 Thread Gary D. Duzan
In article [EMAIL PROTECTED], Rhamphoryncus [EMAIL PROTECTED] wrote: import mainloop, urllib def get_and_save(path): infile = waitfor urllib.urlopen(path, async=True) outfile = waitfor open(path.split('/')[-1], async=True) waitfor outfile.write(waitfor infile.read(async=True),

Re: Proposal for adding Shallow Threads and a Main Loop to Python

2005-03-17 Thread Rhamphoryncus
Gary D. Duzan wrote: A while back I tossed something together to deal with the same issue in terms of futures (or promises.) Here is roughly what the above code would look like with futures as I implemented them: snip This was all done using plain Python 1.5.2 in 80 lines of code,