class iteration_utilities.tabulate(func, start=0)

Return function(0), function(1), ...


func : callable

The function to apply.

start : any type, optional

The starting value to apply the function on. Each time tabulate is called this value will be incremented by one. Default is 0.


tabulated : generator

An infinite generator containing the results of the function applied on the values beginning by start.


Since the return is an infinite generator you need some other function to extract only the needed values. For example getitem():

>>> from iteration_utilities import tabulate, getitem
>>> from math import sqrt
>>> t = tabulate(sqrt, 0)
>>> list(getitem(t, stop=3))
[0.0, 1.0, 1.4142135623730951]


This will return an infinitly long generator so do not try to do something like list(tabulate())!

This is equivalent to:

import itertools

def tabulate(function, start=0)
    return map(function, itertools.count(start))

(any type) The current value to tabulate (readonly).

New in version 0.6.


(callable) The function to tabulate (readonly).

New in version 0.6.