[Python-ideas] asyncore: included batteries don't fit

Antoine Pitrou solipsis at pitrou.net
Sun Oct 7 00:24:02 CEST 2012


On Sat, 6 Oct 2012 15:00:54 -0700
Guido van Rossum <guido at python.org> wrote:
> 
> (2) We're at a fork in the road here. On the one hand, we could choose
> to deeply integrate greenlets/gevents into the standard library. (It's
> not monkey-patching if it's integrated, after all. :-) I'm not sure
> how this would work for other implementations than CPython, or even
> how to address CPython on non-x86 architectures. But users seem to
> like the programming model: write synchronous code, get async
> operation for free. It's easy to write protocol parsers that way. On
> the other hand, we could reject this approach: the integration would
> never be completely smooth, there's the issue of other implementations
> and architectures, it probably would never work smoothly even for
> CPython/x86 when 3rd party extension modules are involved.
> Callback-based APIs don't have these downsides, but they are harder to
> program; however we can make programming them easier by using
> yield-based coroutines. Even Twisted offers those (inline callbacks).

greenlets/gevents only get you half the advantages of single-threaded
"async" programming: they get you scalability in the face of a high
number of concurrent connections, but they don't get you the robustness
of cooperative multithreading (because it's not obvious when reading
the code where the possible thread-switching points are).

(I don't actually understand the attraction of gevent, except for
extreme situations; threads should be cheap on a decent OS)

Regards

Antoine.


-- 
Software development and contracting: http://pro.pitrou.net





More information about the Python-ideas mailing list