Beyond Python's Comfort Zone: Asynchronous Python in 2016-2017
Python was not originally created with concurrency in mind, so with rise in async in modern popular programming languages, how has Python integrated with async in 2016 and 2017 ?
default for many Platforms, such as Linux (Ubuntu, Debian, Fedora) • The most common version of Python being used, but the gap is shrinking. • Support ending on 2020 (2.7) • Future-Proof • In Active Development • Library support not as good as 2.x • Async ready
that are all in progress at the same time, but it is only necessary to work briefly and separately on each task - Doing A while waiting for B • Improved Responsive Experience from end-user • Concurrency is not Parallelism ◦ Tasks are sharing the execution thread while still appearing to be executing in parallel.
the generator function. The value argument becomes the result of the current yield expression. The send() method returns the next value yielded by the generator, or raises StopIteration if the generator exits without yielding another value.
a number of useful third-party python tools. • Written to tackle concurrency natively. • Added to std library • Implements a flexible interface so that it can be tied in with frameworks like Twisted and Tornado
New builtin types for coroutines • async for and async with • Generic, can be tied to Tornado, gevent, etc. • 2x slower than a function call, 10-100x faster than a yield • @types.coroutine turns generators into coroutines • Event loops, futures, tasks, callbacks • Libraries for sockets