Difference between Python’s Generators and Iterators
iterator is a more general concept: any object whose class has a __next__ method (next in Python 2) and an __iter__ method that does return self. Every generator is an iterator, but not vice versa. A generator is built by calling a function that has one or more yield expressions (yield statements, in Python 2.5 … Read more