Using asyncio

The asyncio module allows for the implementation of asynchronous programming using a combination of the following elements:

  • Event loop: The asyncio module allows an event loop per process.
  • Coroutines: A coroutine is a generator that follows certain conventions. Its most interesting feature is that it can be suspended during execution to wait for external processing (the some routine in I/O) and return from the point it had stopped when the external processing was done.
  • Futures: Futures represent a process that has still not finished.
  • Tasks: This is a subclass of asyncio.Future that encapsulates and manages coroutines. We can use the asyncio.Task object to encapsulate a coroutine. 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset