Introducing the asyncio library
The asyncio
library was created to make asynchronous processing much easier and results more predictable. It was introduced with the purpose of replacing the asyncore
module, which has been available for a very long time (since Python 1.5 in fact). The asyncore
module was never very usable, which prompted the creation of the gevent
and eventlet
third-party libraries. Both gevent
and eventlet
make asynchronous programming much easier than asyncore
ever did, but I feel that both have been made largely obsolete with the introduction of asyncio
. Even though I have to admit that asyncio
still has quite a few rough edges, it is in very active development, which makes me think that all the rough edges will soon be fixed by either the core Python library or third-party wrappers.
The asyncio
library was officially introduced for Python 3.4, but a back port for Python 3.3 is available through the Python Package Index. With that in mind, while some portions of this chapter...