Why are "broken iterators" broken?

greg greg at cosc.canterbury.ac.nz
Sat Sep 27 05:15:25 CEST 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