
July 27, 2010
9:40 p.m.
Guido van Rossum wrote:
Have you really thought through the implementation in CPython?
Not at all.
When a non-generator function is called, there's usually a C stack frame in the way which prevents yielding.
Of course. I knew there'd be good reason why you didn't do a more full coroutine implementation originally, but on a beautiful summer day reckless optimism took over and it didn't come readily to mind. On platforms with coroutines available at the C level, I think something could be devised, something like keep a pool of coroutines and switch to a different one at strategic points. But I realise that requiring all platforms to support coroutines is a deal-breaker, so there. - Anders