August 2018
Intermediate to advanced
332 pages
9h 12m
English
Generators are everywhere in Python. Since their inception in Python a long time ago, they proved to be a great addition that makes programs more efficient and iteration much simpler.
As time moved on, and more complex tasks needed to be added to Python, generators helped again in supporting coroutines.
And, while in Python, coroutines are generators, we still don't have to forget that they're semantically different. Generators are created with the idea of iteration, while coroutines have the goal of asynchronous programming (suspending and resuming the execution of a part of our program at any given time). This distinction became so important that it made Python's syntax (and type system) evolve.
Iteration and asynchronous programming ...