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

Ben Darnell ben at bendarnell.com
Tue Oct 9 08:53:11 CEST 2012


On Mon, Oct 8, 2012 at 10:56 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Mark Adam wrote:
>>
>> 1) event handlers for the machine-program interface (ex. network I/O)
>> 2) event handlers for the program-user interface (ex. mouse I/O)
>>
>> While similar, my gut tell me they have to be handled in completely
>> different way in order to preserve order (i.e. sanity).
>
>
> They can't be *completely* different, because deep down there
> has to be a single event loop that can handle all kinds of
> asynchronous events.

There doesn't *have* to be - you could run a network event loop in one
thread and a GUI event loop in another and pass control back and forth
via methods like IOLoop.add_callback or Reactor.callFromThread.
However, Twisted has Reactor implementations that are integrated with
several different GUI toolkit's event loops, and while I haven't
worked with such a beast my gut instinct is that in most cases a
single shared event loop is the way to go.

-Ben

>
> Upper layers can provide different APIs for them, but there
> has to be some commonality in the lowest layers.
>
> --
> Greg
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas



More information about the Python-ideas mailing list