[Python-Dev] Twisted Isn't Specific (was Re: Trial balloon: microthreads library in stdlib)

Joachim König-Baltes joachim.koenig-baltes at emesgarten.de
Wed Feb 14 16:32:10 CET 2007


glyph at divmod.com wrote:

> When you boil it down, Twisted's event loop is just a notification for 
> "a connection was made", "some data was received on a connection", "a 
> connection was closed", and a few APIs to listen or initiate different 
> kinds of connections, start timed calls, and communicate with threads. 
>  All of the platform details of how data is delivered to the 
> connections are abstracted away.  How do you propose we would make a 
> less "specific" event mechanism?
But that is exactly the problem I have with Twisted. For HTTP it creates 
its own set of notifications instead of structuring the code similar to
SocketServer (UDP and TCP), BaseHTTPServer, SimpleHTTPServer etc which 
are well understood in the python community and e.g.
used by medusa and asyncore. Having to completely restructure one's own 
code is a high price.

Giving control away into a big framework that calls my own code for  not 
so easy to understand reasons (for a twisted noob) does not give
me a warm feeling. It's o.k. for complex applications like web servers 
but for small networking applications I'd like to have a chance to
understand what's going on. Asyncore is so simple that it's easy to 
follow when I let it do the select() for me.

That said, I conclude that the protocol implementations are superb but 
unfortunately to tightly coupled to the Twisted philosophy, sitting
in the middle, trying to orchestrate instead of being easy to integrate.

Joachim


More information about the Python-Dev mailing list