[Python-ideas] PEP 3156/Tulip: Extensible EventLoop interface

Nick Coghlan ncoghlan at gmail.com
Sun Feb 3 05:36:53 CET 2013


On Sun, Feb 3, 2013 at 6:10 AM, Ben Darnell <ben at bendarnell.com> wrote:
> The event loop interface in PEP 3156 has an extensibility problem.  It seems
> likely that it will have a method like listen_udp() by the time it's done,
> but suppose that doesn't make it into the first official release.
> Third-party event loop implementations may want to provide UDP support as an
> extension, but the most consistent way to provide that extension is by
> adding new methods on the event loop object, where various extensions risk
> conflicting with each other or with new methods that become standardized
> later.

The general idea of using factory functions for transport creation,
even for the "core transports" (like sockets, SSL and pipes) sounds
good to me. I've expressed some concerns previously about the breadth
of the event loop class API, and this would go a long way towards
alleviating them.

As far as precedents for the proposed dispatch/registration mechanism
goes, probably the closest we currently have is the codecs registry. A
"transport registry" (using Python dottedname identifiers as the
naming scheme) sounds promising to me.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-ideas mailing list