[Python-Dev] Py3k and asyncore/asynchat
Josiah Carlson
josiah.carlson at gmail.com
Mon Mar 24 23:51:56 CET 2008
Let us not get side-tracked in this discussion. Whether or not to
include any portion of Twisted into Python 2.6 is well past being a
reasonable question; 2.6 alpha 1 has been released. It's a question
as to whether someone with commit access can or will commit the patch
as posted, run the tests to verify that they aren't broken, and
perhaps actually look at the code to verify that we (Giampaolo and I)
aren't insane. Mind you, I've been using very similar variants of
this patch for months; it fixes outstanding bugs, improves
performance, makes the handle* interfaces more consistent, and even
offers a 'sample' implementation of a basic protocol in the source
(for those who are willing to look). Do we want to fix
asyncore/asynchat with work that has already been done and tested?
If you want a reason as to why twisted shouldn't *replace*
asyncore/asynchat, I'll give you a few: As stated previously by Guido
and others (please see previous threads about this over the course of
the last 4 years), asyncore/asynchat provide a more or less minimal
interface for asynchronous sockets in Python. Any module/package that
seeks to implement asynchronous sockets will need to, at least,
implement that much. Asyncore/asynchat at present will play nicely
with any event loop available, given certain caveats*. Further, if
someone spends a half hour reading the source of a reasonably written
asyncore server/client, they should understand the basics and be able
to begin using it directly (see any one of the simple echo variants).
As to whether twisted should be added to the standard library at some
point in the future as a "this is better than asyncore in every way,
use this instead"; that is a different discussion, not related to 2.6
(perhaps not even related to the 2.x series at all, depending on the
future of 2.x).
- Josiah
* If your application strictly responds to socket IO, then implement
your application as part of handle_* methods. If your application
does more, then call asyncore.poll() often enough for data to be
handled sufficiently fast. If neither offer sufficient performance or
flexibility (maybe something like bittorrent + wxPython), use one
thread for your GUI, one thread for your sockets, and use
Queue.Queue() or some other threadsafe message delivery method.
On Mon, Mar 24, 2008 at 3:18 PM, A.M. Kuchling <amk at amk.ca> wrote:
> On Mon, Mar 24, 2008 at 10:04:20PM +0100, Thomas Wouters wrote:
> > I remember only a couple of dissenting voices, and only a small number of
> > participants. Of the dissenting voices, I do not recall any actual arguments
>
> Weren't some of those dissenting voices the Twisted developers, though?
>
> --amk
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/josiah.carlson%40gmail.com
>
More information about the Python-Dev
mailing list