First page Back Continue Last page Overview Graphics

Infinite Iterators: count

count(start=0, step=1) --> count object

count returns a count object which returns consecutive values.

Equivalent to:

def count(firstval=0, step=1):

x = firstval

while True:

yield x

x += step