How to make an iterator in Python PREMIUM

Topic Series: Generator Functions

Trey Hunner smiling in a t-shirt against a yellow wall
Trey Hunner
5 minute read Works on Python 3.7—3.10
Python Morsels
Watch as video

How you can make your own iterator objects in Python?

Iterators need to work with iter and next

An [iterable][] is an object that can be **passed to the built-in iter function to ...

Write more Pythonic code

Need to fill-in gaps in your Python skills? I send regular emails designed to do just that.