An iterator is just a class that defines an __iter__(self) method. __iter__(self) function is automatically called when iter(inst) is called, where inst is an instance of this class. After performing beginning-of-iteration initialization, the __iter__() method returns any object that implements a __next__() method. Sometimes it just return self, because the...
[Read More]