Generators ========== Generators provide an elegant way to write simple and efficient code for functions that return a sequence of elements. Based on the ``yield`` statement, they allow you to pause a function and return an intermediate result. The function saves its execution context and can be resumed later, if necessary. .. include:: creating_generators.rst .. include:: iterating_idiomatically.rst .. include:: coroutines.rst .. include:: asynchronous_programming.rst