Friday, October 21, 2005

Python Coroutines Schedulers

Just wanted to post a quick thought, mostly so I would remember it. I want to try to write a small decorator to turn any function into a coroutine, associated with a particular scheduler. When called, the coroutine would return a handler, and the scheduler would continue normally. it would be able to tell when a coroutine was called by another, and handle that appropriately, allowing the yields of the inner call to be yielded by the handler as an iterator. This would allow coroutines to be called pretty much just like functions, with everything being scheduled in the background pretty nicely.

No comments: