Re: [Numpy-discussion] numpy.fromfunction() doesn't work as expected?

2012-07-20 Thread Warren Weckesser
On Thu, Jul 19, 2012 at 5:52 AM, Cheng Li wrote: > Hi All, > > ** ** > > I have spot a strange behavior of numpy.fromfunction(). The sample codes > are as follows: > > >>> import numpy as np > > >>> def myOnes(i,j): > > return 1.0 > > >>> a = np.fromfunction(myO

[Numpy-discussion] numpy.fromfunction() doesn't work as expected?

2012-07-19 Thread Cheng Li
Hi All, I have spot a strange behavior of numpy.fromfunction(). The sample codes are as follows: >>> import numpy as np >>> def myOnes(i,j): return 1.0 >>> a = np.fromfunction(myOnes,(2000,2000)) >>> a 1.0 Actually what I expected is that the function will return a 20