On 2010-01-23, Roald de Vries <r...@roalddevries.nl> wrote: > Dear all, > > I sometimes want to use an infinite while loop with access to the loop > index, like this: > > def naturals(): > i = 0 > while True: > yield i > y += 1 > > for i in naturals(): > print(i) > > I assume a function like 'naturals' already exists, or a similar > construction for the same purpose. But what is it called?
xrange(), except that you need to provde an upper limit. -- Grant -- http://mail.python.org/mailman/listinfo/python-list