[Python-ideas] PEP 380 alternative: A yielding function
Anders J. Munch
2010 at jmunch.dk
Tue Jul 27 21:40:13 CEST 2010
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
More information about the Python-ideas
mailing list