But C calls are NOT atomic -- C code can call back to Python. This
currently happens in a number of built-in functions, e.g. apply(),
map(), filter(), reduce(), and don't forget exec, eval() and import!
While these may be thought of as part of the implementation and
somehow mendable (e.g. by returning the code object to be executed
instead of executing it directly), another category which is harder to
argue with are callback functions from libraries, e.g. Xt/Motif
widgets.
We could make these special cases not to be messed with in coroutines,
but it would mean that occasionally there would be a set of execution
environments separated by a bit of C stack that could not talk to each
other!
> I've finished my sci-fi book, so my silence on these matters has been due
> mostly to the fact that I'm actually tring to figure out an implementation so
> I CAN play with it. If I give up on coroutines and/or continuations in
> the *language*, my fall back is to try to support portable threads via
> this mechanism.
BUt portable threads would siffer from the same problem!
--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
URL: <http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>