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

2005-03-18 Thread Rhamphoryncus
Diez B. Roggisch wrote: > 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

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 waitfo

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: >This was all done using plain Python 1.5.2 in 80 lines of code,

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