Skip to Content
Clean Code in Python - Second Edition
book

Clean Code in Python - Second Edition

by Mariano Anaya
January 2021
Intermediate to advanced
422 pages
10h 39m
English
Packt Publishing
Content preview from Clean Code in Python - Second Edition

7

Generators, Iterators, and Asynchronous Programming

Generators are another one of those features that makes Python a peculiar language over more traditional ones. In this chapter, we will explore their rationale, why they were introduced in the language, and the problems they solve. We will also cover how to address problems idiomatically by using generators, and how to make our generators (or any iterable, for that matter) Pythonic.

We will understand why iteration (in the form of the iterator pattern) is automatically supported in the language. From there, we will take another journey and explore how generators became such a fundamental feature of Python in order to support other functionality, such as coroutines and asynchronous programming. ...

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

Clean Code in Python

Clean Code in Python

Mariano Anaya

Publisher Resources

ISBN: 9781800560215Supplemental Content