Building with an Alternate Model: asyncio

A discussion of concurrency in Python is not complete without mentioning the asyncio module. asyncio is noteworthy for several reasons including that it is a recent addition to Python (arriving in Python 3.4) and includes its own special reserved keywords async and await.

So far, we’ve talked about using threads and processes in Python—neither of those had their own dedicated reserved keywords. asyncio is different than threads and processes primarily because asyncio relies on a programming paradigm called cooperative multitasking. The asyncio reserved keywords async and await help facilitate running code in this cooperative multitasking model.

What does cooperative multitasking mean? Let’s learn more ...

Get Intuitive Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.