Looping and Iterations
TL;DR
Iterators provide a sequence interface to Python objects that’s memory efficient and considered Pythonic. To support iteration an object needs to implement the iterator protocol by providing the __iter__ and __next__ dunder methods.
2023-01-14