Generators: are doing my head in ! Been coding up the generator based async IO approach I mentioned recently this afternoon. I want real, non blocking, multi threaded concurrency. I use generators to yield after sending down a socket. And then I resume when I get a Twisted callback telling me a response has arrived. That way no thread blocks waiting on a response. Less threads, more busyness.
Figuring out where to yield and when to return, and thinking about when I want resumable stack state, and when I don't, has been a head twisting experience. Which is great, because that means I am acquiring a non trivial design idiom. Last time I had this experience was my first multithreaded code in the late 90s. Before that it was OO in the early 90s. All good stuff.