We're back after a server migration that caused effbot.org to fall over a bit harder than expected. Expect some glitches.


iter(sequence) or iter(callable, sentinel)

Returns an iterator object. If a single sequence argument is given, it must be a sequence object which supports the iteration protocol (the __iter__ method) or the sequence protocol (the __getitem__ method with integer arguments starting at 0). If it does not support either of those protocols, TypeError is raised.

If two arguments are given, the first argument must be a callable object. The iterator created in this case will call the callable with no arguments for each call to its next method; if the value returned is equal to sentinel, StopIteration will be raised, otherwise the value will be returned.

(New in version 2.2.)