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

Matthias Urlichs matthias at urlichs.de
Tue Oct 16 20:40:07 CEST 2012


I'll have to put in my ..02€ here …

Guido van Rossum <guido at ...> writes:

> (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.

Yes.

I have two and a half reasons for this.

(½) Ultimately I think that switching stacks around is always going to be faster
than unwinding and re-winding things with yield().

(1) It's a whole lot easier to debug a problem with gevent than with anything
which uses yield / Deferreds / asyncore / whatever. With gevent, you get a
standard stack trace. With anything else, the "where did this call come from"
information is not part of the call chain and thus is either unavailable, or
will have to be carried around preemptively (with associated overhead).

(2) Nothing against Twisted or any other async frameworks, but writing any
nontrivial program in it requires warping my brain into something that's *not*
second nature in Python, and never going to be.

Python is not Javascript; if you want to use the "loads of callbacks"
programming style, use node.js.


Personal experience: I have written an interpreter for an asynchronous and
vaguely Pythonic language which I use for home automation, my lawn sprinkers,
and related stuff (which I should probably release in some form). The code was
previously based on Twisted and was impossible to debug. It now uses gevent and
Just Works.

-- 
-- Matthias Urlichs




More information about the Python-ideas mailing list