3 ms·
Can you provide a more explicit example, perhaps a Stackless alternative to one of the ones from Beazley's page?
by bayareaguy 19y ago
Can you provide a more explicit example, perhaps a Stackless alternative to one of the ones from Beazley's page?
- jmtulloss 19y agoThe most obvious is coroutines: def ping(): while ping_channel.receive(): #blocks here print "PING" pong_channel.send("from ping") def pong(): while pong_channel.receive(): print "PONG" ping_channel.send("from pong") Most of the things that he has in there don't need to be done with generators, though generators make it more efficient and arguably cleaner. However, sometimes generators are just a twisted workaround for controlling program flow. Channels and tasklets in Stackless express program flow very well, in my opinion. You can see more of what stackless has to offer here: http://members.verizon.net/olsongt/stackless/why_stackless.html http://members.verizon.net/olsongt/stackless/why_stackless.h...