
On Friday 10 July 2009, Gleb Alexeyev wrote:
Marcin Kosiba wrote:
Hi, To illustrate what I meant I'm attaching two examples. In example_1.py I've written code the way I think would be elegant (but it doesn't work). In example_2.py I've written code so that it works, but it isn't elegant. I know I'm abusing Python iterators here. Also, I'm not sure the way to compose iterators shown in example_2.py is the only option. Actually I'd love to see a better solution, because it would remove a lot of bloat from my code ;)
You may want to look at Lua coroutines, which are more powerful than Python iterators. Your example_1.py is very similiar to the example in the Coroutines Tutorial [1].
That in turn looks similar to Stackless Python[1], which I've been looking over recently ;) [1] http://www.stackless.com/wiki/Channels Thanks! Marcin Kosiba