Documents are numpy.fromfunctionextremely misleading. Instead of repeatedly calling your function and building an array from the results, it fromfunctionactually only makes one call to the function you pass. In this one call, instead of separate indices, it passes multiple index arrays.
docstring, :
def fromfunction(function, shape, **kwargs):
dtype = kwargs.pop('dtype', float)
args = indices(shape, dtype=dtype)
return function(*args,**kwargs)
, , numpy.fromfunction , .