[Python-Dev] Py3k and asyncore/asynchat
Adam Olsen
rhamph at gmail.com
Mon Mar 24 23:25:51 CET 2008
On Mon, Mar 24, 2008 at 3:37 PM, Thomas Wouters <thomas at python.org> wrote:
>
> On Mon, Mar 24, 2008 at 10:21 PM, Adam Olsen <rhamph at gmail.com> wrote:
> >
> > Twisted may be one of the best (if not *the* best) ways of writing
> > concurrent programs today, but it doesn't need to be in the stdlib for
> > that. If safethread is going to solve many of the same problems, with
> > less changes required by the users of the language, then this is the
> > wrong time to add twisted.
> >
>
> You must have missed the part where we already have a large set of event
> loops, and not having a single interface to them is in fact hurting people.
> Twisted goes out of its way to interact nicely with event loops, but it can
> only do that with ones it knows about (and are versatile enough to hook
> into.) Having a single event system in the standard library is definitely
> advantageous, even if safethreads were available everywhere and the
> performance in the common case was satisfactory. It used to be the case that
> people thought asyncore was this standard event system, but it's long since
> ceased to be.
I'm not opposed to standardizing on twisted as the canonical way to do
events in python, or to having an event system in python. My concern
is that may be used as an excuse to slowly rewrite the entire language
into an event-driven model.
However, that was based on the assumption that modules like urllib2
weren't already event-driven. Looking now, it seems it already is,
and wraps it in a blocking API for simple use cases.
So long as we're only talking about replacing existing event-driven
stuff, and so long as we retain the existing blocking API (including
calling from threads!), I don't think I have any valid opposition.
--
Adam Olsen, aka Rhamphoryncus
More information about the Python-Dev
mailing list