Go to content

Anton Caceres - Better asynchronous code with Tornado and Python 3

Anton Caceres - Better asynchronous code with Tornado and Python 3 [EuroPython 2015] [23 July 2015] [Bilbao, Euskadi, Spain] The asyncio module introduced in Python 3.4 is a game-changer for I/O management and event-driven network programming in Python. Aiming to be a lower-level implementation of an asynchronous event loop, it intends that higher level frameworks like Tornado, Twisted or Gevent will build on top of it, taking advantage of the shared interface for writing concurrent event-driven code across different Python frameworks. This talk connects theory with practice, presenting how Tornado can run in the asyncio event loop and take advantage of the subgenerator delegation syntax (yield from) to provide a high degree of concurrency while keeping the simplicity of sequential code. It explains the concept of coroutines, futures and ioloop, exposing Python 3 code for sample web tasks. The talk completes with a basic demo of running this code on Tornado, comparing its syntax and performance with popular asynchronous frameworks from other languages.

July 20, 2015