Skip to Content
Mastering Python 2E - Second Edition
book

Mastering Python 2E - Second Edition

by Rick Hattem
May 2022
Intermediate to advanced
710 pages
16h 41m
English
Packt Publishing
Content preview from Mastering Python 2E - Second Edition

13

asyncio – Multithreading without Threads

The previous chapter showed us how to track our application performance. In this chapter, we will use asynchronous programming to switch between functions whenever we have to wait for input/output (I/O) operations. This effectively fakes the effects of multiple threads or processes without introducing the overhead that comes with those solutions. In the next chapter, we will also cover multiple threads and processes for the cases where I/O is not your bottleneck or where asyncio is not an option.

Whenever you are dealing with external resources such as reading/writing files, interacting with APIs or databases, and other I/O operations, you can achieve great benefits from using asyncio. Where normally ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Object-Oriented Python - Second Edition

Mastering Object-Oriented Python - Second Edition

Steven F. Lott

Publisher Resources

ISBN: 9781800207721Supplemental Content