Change the future

Friday 1:55 p.m.–2:25 p.m.

Twisted Logic: Endpoints and Why You Shouldn't Be Scared of Twisted

Ashwini Oruganti

Audience level:


This talk will be a survey of my learning experience adding new endpoint APIs to Twisted, an event-driven networking engine (as a Google Summer of Code project), with a special focus on the analysis of some of the horror stories that surround Twisted. Right from the asynchronous I/O model to Deferreds: if it scares you, we’ll figure a way out and see what the makers of Twisted say when confronted.


It all started with the announcement of Google Summer of Code 2012. I was a student. I had a free summer. And I could kind-of read/write bits and pieces of code.

Now, I needed an open-source project to put it all together and build an awesome summer around it.
I picked Twisted, submitted a proposal, and it got accepted.


Enter endpoints, the interfaces I was supposed to write. Endpoints are basically APIs that help you describe your servers and clients in your connection. Twisted already had some endpoint support like those for TCP (IPv4), SSL and UNIX domain sockets, and I was going to try and add some more: starting with an easy TCP server endpoint that could be used with the IPv6 address family, I moved on to Standard I/O endpoint, a TCP IPv6 endpoint that does name resolution, an endpoint for serial port support, and one for child processes.

The Scary parts

Remember how we were taught about reflex-action in school? When I decided to spend the summer working with Twisted, I didn't know people shudder from the sheer mention of it. We tried asking the Python community about this, and got responses like “I've heard Twisted softens your brains and makes you feel like your head is actually a blender optimized for gray gloop.”

Here, I'm going to try and figure out why exactly is everyone so frightened of Twisted - What is it that scares everyone away, and leads to such stories of terror and sorrow? I'll try and bust myths with what I’ve learnt about Twisted so far, and tackle each possible reason, right from the asynchronous I/O model, factories, Deferreds and callbacks, to complaints about complex design and documentation that could've lead to the scary Twisted legends, and help you survive it all.