[Numpy-discussion] fumfunction question
Travis Oliphant
oliphant at ee.byu.edu
Wed Apr 18 14:52:03 EDT 2007
Mark.Miller wrote:
>OK...I think I understand. But just to clarify:
>
>Suppose I have a function that can take 3 parameters
>
>def f(x,y,constant):
> operations
>
>Is it appropriate to use something like
>
>a=numpy.fromfunction(f,(x,y),const)
>
>where x and y give the array dimensions and const is another variable
>that is used to perform operations within f.
>
>I know that it doesn't work, but I just wanted to check to see if there
>is possibly a syntax that can work.
>
>
No, you can only pass extra keyword arguments on to the function. Thus,
def f(x,y,myval=3):
operations
could be called as
a = numpy.fromfunction(f, (10,20), myval=4)
-Travis
More information about the NumPy-Discussion
mailing list