This post is about making an object an iterator in Python.
In Python 2, this means that you need to implement the __iter__() method and the next() method. But in Python 3 you need to implement a different method, instead of next() you need to implement __next__() .
How to make an object that is an iterator in both Python 2 and 3?
AlexLordThorsen
source share