News for hackers. Stuff that matters.
Re:Co-routines as an alternative to state machines by mcav on Saturday August 29, 2009 @10:33AM (#793210)
For cool Python coroutines with networking code, have a look at Eventlet. I'm using it for a lot of my server code; it makes server-side socket programming dead-simple to understand.
Re:Co-routines as an alternative to state machines by btw0 on Saturday August 29, 2009 @11:10AM (#793250)
Also don't forget cogen, a library for network oriented, coroutine based programming using the enhanced generators from python 2.5. I recently used it as a front-end concurrent WSGI server in my Google Summer of Code project.

Besides state machine simulation, corotine has many other usages as well (eg. implement concurrency), it is a very powerful tool that not many programmers know. For those who are interested, I suggest a tutorial:

http://www.dabeaz.com/coroutines/