Why are "broken iterators" broken?

greg greg at cosc.canterbury.ac.nz
Fri Sep 26 23:15:25 EDT 2008


Craig Allen wrote:

> In the end I interpreted that statement as if "unless __iter__()" is
> called again

It seems you were confusing iterators and iterables. The
iterator is the object that is returned by calling
__iter__() on an iterable, and yes, you are expected to
get a new one each time you want to start iterating
again.

-- 
Greg



More information about the Python-list mailing list