Python โ From Basics to Advanced ยท Generators and Iterators
Iterators and the Iteration Protocol
Generators and Iterators
Introduction
An iterable is any object you can loop over with for. An iterator is an object with a __next__ method. Lists, sets, and dicts are iterables โ but you get an iterator by calling iter() on them.