[Python-Dev] Minimal 'stackless' PEP using generators? (original) (raw)

Christian Tismer tismer at stackless.com
Thu Aug 26 17:12:46 CEST 2004


Clark C. Evans wrote:

...

With these two changes, the "lower" function could be an async reactor like those found in Twisted, or async core. While the result isn't true coutines, it would be a huge improvement for those who would like to do async coding. I've done something similar with Twisted called Flow [1] and it works well, with the exception of being a painful syntax hack and being quite slow. If this was moved into Python's core, we'd get most of the advantages of coroutines without the full cost.

Thoughts?

Well, I just think "no". Generators, as limited as they are in Python, make some sense. Coroutines for me have the advantage to make a context switch. While generators are very often called in a context where they even could be inlined, coroutines should be really independent. But they are not independent if you just cannot switch, because one of them just happens to call a different function. A typical use of coroutines is the situation where it cannot be deduced who is caller or callee.

What I mean, those situations which can be solved with a stack are the trivial cases, and that is exactly not what Stackless is about.

ciao - chris

Christian Tismer :^) <mailto:tismer at stackless.com> tismerysoft GmbH : Have a break! Take a ride on Python's Carmerstr. 2 : Starship http://starship.python.net/ 10623 Berlin : PGP key -> http://wwwkeys.pgp.net/ work +49 30 31 86 04 18 home +49 30 802 86 56 mobile +49 173 24 18 776 PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04 whom do you want to sponsor today? http://www.stackless.com/



More information about the Python-Dev mailing list