© Sunil Kapil 2019
Sunil KapilClean Pythonhttps://doi.org/10.1007/978-1-4842-4878-2_6

6. Generators and Iterators

Sunil Kapil1 
(1)
Sunnyvale, CA, USA
 

Iterators and generators are useful tools in Python. They can make it easier to handle different data problems, and they help you to write code that is cleaner and performs better.

Python has a library to take advantage of these two features. You will learn about them in this chapter, and you will explore different problems that can be easily handled by generators and iterators without much effort.

Take Advantage of Iterators and Generators

In this section, you will explore different features of iterators and generators and will see where these two features can be used in your code to make it better. Both ...

Get Clean Python: Elegant Coding in Python 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.