Concurrent programs are super useful: think of web apps juggling lots of simultaneous downloads and websocket connections, chat bots tracking multiple concurrent conversations, or web spiders fetching pages in parallel. But writing concurrent programs is complicated, intimidating to newcomers, and often challenging even for experts.
Does it have to be? Python is famous for being simple and straightforward; can Python make concurrent programming simple and straightforward too? Trio is an attempt to address this question by the positive !
By taking advantage of new Python 3 features (async/await keywords, async loops and context managers etc.) while dropping legacy concepts that older asynchronous frameworks has to maintain, Trio defines a new set of primitives that make it dramatically easier to write correct concurrent programs.
In this talk, we will describe those primitives, and demonstrate how to use them to implement a basic algorithm for speeding up TCP connections. Compared to the best previous Python implementation, our version turns out to be easier to understand, more correct, and dramatically shorter.