[Python-Dev] Socket timeout and completion based sockets
glyph at twistedmatrix.com
Wed Nov 28 20:15:07 CET 2012
On Nov 28, 2012, at 12:04 PM, Guido van Rossum <guido at python.org> wrote:
>> Anyway, as for concrete requirements: The issue I have always seen with various asynchronous libraries is their lack of composability. Everyone writes their own application loop and event queue. Merely having a standard spec and reference implementation of an application main loop object, and main event queue object, in the spirit of WSGI, would possibly remedy this. You could then hopefully assemble various different libraries in the same application, including greenlet(*) based ones.
> Hm. I agree with the first part of this -- and indeed I am planning to
> make it so that tulip's event loop can easily be replaced by another
> one. I'm less sure about the yield-from-based scheduler, that's the
> kind of thing for which it doesn't really make sense to have multiple
> implementations. If greenlets can work with the standard event loop
> interface, good for them. (Either by providing a conforming
> implementation that also supports greenlets, or by just using the
> standard implementation.)
I'm really happy that you are building this in as a core feature of Tulip. It's really important.
Very early on, Twisted attempted to avoid this lack of composability by explicitly delegating to other application loops; it's one of my favorite features of Twisted. Granted, no two loops we have attempted to use have themselves been composable, but there's not much we can do about that :). Still, code written on top of Twisted can always be plugged in to any other loop by simply using the appropriate reactor. (There's also a plug-in interface for the reactor and a plug-in discovery mechanism so that third parties can easily provide their own reactors if they have an unusual main loop that isn't supported by twisted itself.)
I would also like to bring up <https://github.com/lvh/async-pep> again. If anyone really wants to dig in and enumerate the use-cases for the _lower-level_ event delivery portions of Tulip, something that would be compatible with Twisted and Tornado and so on, that PEP already has a good skeleton and could use some pull requests.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev