Handling coroutines with Asyncio

We saw, in the course of the various examples presented, that when a program becomes very long and complex, it is convenient to divide it into subroutines, each of which realizes a specific task for which it implements a suitable algorithm. The subroutine cannot be executed independently, but only at the request of the main program, which is then responsible for coordinating the use of subroutines. Coroutines are a generalization of the subroutine. Like a subroutine, the coroutine computes a single computational step, but unlike subroutines, there is no main program that can be used to coordinate the results. This is because the coroutines link themselves together to form a pipeline without any supervising function ...

Get Python Parallel Programming Cookbook 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.