iterable terminology (for language lawyers)

Leif K-Brooks eurleif at ecritters.biz
Wed Mar 16 03:45:12 EST 2005


Michele Simionato wrote:
> According to the standand library 
> (http://docs.python.org/lib/typeiter.html) an *iterable* is something
> with an __iter__ method. This means that strings are *not* iterable.

In general, the definitions people in the Python community tend to use are:

Iterable: An object which doesn't raise TypeError when passed to iter().
Reiterable: An object which can be passed to iter() multiple times 
without returning itself.
Iterator: An object which defines a next() method and returns itself 
when passed to iter().



More information about the Python-list mailing list