[PEAK] Reactor-driven microthreads

Bob Ippolito bob at redivi.com
Wed Dec 31 12:12:41 EST 2003


On Dec 31, 2003, at 12:22 AM, Phillip J. Eby wrote:

> Hm.  This seems like the first really good use case I've seen for  
> having a macro facility in Python, since it would allow us to spell  
> the yield+errorcheck combination with less boilerplate.  Ah well.

That, and "flattening" generators

def someGenerator():
     for something in someOtherGenerator():
         yield something

This gets really ugly after a while, but it happens a lot when you are  
doing "microthreads".  I'd be happy with a "yieldall" keyword, or a  
facility to make that happen.  Stackless might be able to do it, but  
macros would definitely work.  Of course macros would be better than a  
new keyword, but people are afraid of macros.

By the way, the microthread thing in Twisted has been talked about  
before (  
http://twistedmatrix.com/pipermail/twisted-python/2003-February/ 
002808.html ) and is implemented to some extent as twisted.flow  
(entirely different from the flow module in that discussion).

-bob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2357 bytes
Desc: not available
Url : http://www.eby-sarna.com/pipermail/peak/attachments/20031231/402cce04/smime.bin


More information about the PEAK mailing list