The iter() built-in takes two different forms, the familiar iter(iterable) we all know and love, and an alternative form:
iter(callable, sentinel) E.g.: >>> T = -1 >>> def func(): ... global T ... T += 1 ... return T ... >>> it = iter(func, 3) >>> next(it) 0 >>> next(it) 1 >>> next(it) 2 >>> next(it) Traceback (most recent call last): File "<stdin>", line 1, in <module> StopIteration I've never seen this second form in actual code. Does anyone use it, and if so, what use-cases do you have? -- Steven -- http://mail.python.org/mailman/listinfo/python-list