[Python-ideas] asyncore: included batteries don't fit
chrysn at fsfe.org
Sat Sep 22 18:31:06 CEST 2012
i'd like to start discussion about the state of asyncore/asynchat's
adaption in the python standard library, with the intention of finding a
roadmap for how to improve things, and of kicking off and coordinating
here's the problem (as previously described in [issue15978] and
redirected here, with some additions):
the asyncore module would be much more useful if it were well integrated
in the standard library. in particular, it should be supported by:
* BaseHTTPServer / http.server (and thus, socketserver)
* urllib2 / urllib, http.client
* probably many other network libraries except smtpd, which already uses
* third party libraries (if stdlib leads the way, the ecosystem will
follow; eg pyserial)
without widespread asyncore support, it is not possible to easily
integrate different servers and services with each other; with asyncore
support, it's just a matter of creating the objects and entering the
main loop. (eg, a http server for controlling a serial device, with a
telnet-like debugging interface).
some examples of the changes required:
* the socketserver documents that it would like to have such a
framework ("Future work: [...] Standard framework for select-based
multiplexing"). due to the nature of socketserver based
implementations (blocking reads), we can't just "add glue so it
works", but there could be extensions so that implementations can be
ported to asynchronous socketservers. i've done if for a particular
case (ported SimpleHTTPServer, but it's a mess of monkey-patching and
* for subprocess, there's a bunch of recipies at .
* pyserial (not standard library, but might as well become) can be
ported quite easily .
this touches several modules whose implementations can be handled
independently from each other; i'd implement some of them myself.
terry.reedy redirected me from the issue tracker to this list, hoping
for controversy and alternatives. if you'd like to discuss, throw in
questions, and we'll find a solution. if you'd think talk is cheap, i
can try to work out first sketches.
python already has batteries for nonblocking operation included, and i
say it's doing it right -- let's just make sure the batteries fit in the
Es ist nicht deine Schuld, dass die Welt ist, wie sie ist -- es wär' nur
deine Schuld, wenn sie so bleibt.
(You are not to blame for the state of the world, but you would be if
that state persisted.)
-- Die Ärzte
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 836 bytes
Desc: Digital signature
More information about the Python-ideas