An Introduction to Asynchronous Programming in Python

While asynchronous programming (AP) is standard fare in JavaScript and baked into the design of Go as goroutines, many Python programmers are new to this concept. The central idea is to achieve concurrent execution of multiple functions in a single program thread. While one function waits for an outside event, such as getting I/O from the web or a database, another function is executed to fill the otherwise-wasted time.

Some AP functionality has been available since Python 3.5, however key functions such as asyncio.run are only available…