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

Cheng Li scrappedprince.li at gmail.com
Thu Jul 19 06:52:02 EDT 2012


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 2000*2000 2d
array with unit value. The returned single float value really confused me.
Is this a known bug? The numpy version I used is 1.6.1.

 

Regards,

Cheng

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20120719/481cdf19/attachment.html>


More information about the NumPy-Discussion mailing list