...

/

Generators

Generators

This lesson introduces generators and how to use them in Python.

We'll cover the following...

Generators

If you read the previous chapter, you know that iterators are objects that are regularly used with for loops. In other words, iterators are objects that implement the iteration protocol. A Python generator is a convenient way to implement an iterator. Instead of a class, ...