Re: [Numpy-discussion] Fromfunction generalization

2008-04-22 Thread Alan G Isaac
On Tue, 22 Apr 2008, lorenzo bolla apparently wrote: > M=fromfunction(lambda i,j:f(i,j,5),(1000,1000)) > P=fromfunction(lambda i,j:f(i,j,7),(1000,1000)) Maybe partial function application is nicer: http://docs.python.org/whatsnew/pep-309.html> fwiw, Alan Isaac __

Re: [Numpy-discussion] Fromfunction generalization

2008-04-22 Thread Gnata Xavier
Well done in python :) Is there a "numpy way" to do that (only asking for the fun because this solution is nice)? Xavier, who do like lamba functions :) > what about using lambda functions? > > M=fromfunction(lambda i,j:f(i,j,5),(1000,1000)) > P=fromfunction(lambda i,j:f(i,j,7),(1000,1000)) > > L

Re: [Numpy-discussion] Fromfunction generalization

2008-04-22 Thread lorenzo bolla
what about using lambda functions? M=fromfunction(lambda i,j:f(i,j,5),(1000,1000)) P=fromfunction(lambda i,j:f(i,j,7),(1000,1000)) L. On Tue, Apr 22, 2008 at 8:42 PM, Gnata Xavier <[EMAIL PROTECTED]> wrote: > Hi, > > fromfunction is fine but I have like to be able to create 2Darrays using > a f

[Numpy-discussion] Fromfunction generalization

2008-04-22 Thread Gnata Xavier
Hi, fromfunction is fine but I have like to be able to create 2Darrays using a function of i,j but also of one (or more) parameters. Something like that : def f(i,j,a): return (i+j)*a #replace that by another non trivial computation M=fromfunction(f( hum well something like i,j,a),(1000,100