Next / Previous / Contents / TCC Help System / NM Tech homepage

20.21. iter(): Produce an iterator over a sequence

Given a sequence S, this function returns an iterator that generates the elements of the sequence. For more information, see Section 24.2, “Iterators: Values that can produce a sequence of values”.

>>> listWalker = iter ( [23, 47, 'hike'] )
>>> for x in listWalker: print x,
... 
23 47 hike

In general, the calling sequence is:

iter(s[, sentinel])