[Python-ideas] Tulip / PEP 3156 - subprocess events

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Jan 19 00:59:38 CET 2013


Guido van Rossum wrote:

> Well, except that you can't just pass CallbackProtocol where a
> protocol factory is required by the PEP -- you'll have to pass a
> lambda or partial function without arguments that calls
> CallbackProtocol with some arguments taken from elsewhere.

Something smells wrong to me about APIs that require protocol
factories. I don't see what advantage there is in writing

    create_connection(HTTPProtocol, "some.where.net", 80)

as opposed to just writing something like

    HTTPProtocol(TCPTransport("some.where.net", 80))

You're going to have to use the latter style anyway to set up
anything other than the very simplist configurations, e.g.
your earlier 4-layer protocol stack example.

So create_connection() can't be anything more than a convenience
function, and unless I'm missing something, it hardly seems to
add enough convenience to be worth the bother.

-- 
Greg



More information about the Python-ideas mailing list