immediate fill after empty gives None.
Have I done something silly here, or is this a bug? Opteron 64-bit, r2631 SVN. In [4]: depths_s2 = empty(shape=(5,),dtype=float) In [5]: depths_s2.fill(2.e5) In [6]: depths_s2 Out[6]: array([ 200000., 200000., 200000., 200000., 200000.]) In [11]: depths_s2 = (empty(shape=(5,),dtype=float)).fill(2.e5) In [12]: print depths_s2 None --George Nurser.
Hi,
Opteron 64-bit, r2631 SVN.
In [4]: depths_s2 = empty(shape=(5,),dtype=float) In [5]: depths_s2.fill(2.e5) In [6]: depths_s2 Out[6]: array([ 200000., 200000., 200000., 200000., 200000.])
In [11]: depths_s2 = (empty(shape=(5,),dtype=float)).fill(2.e5) In [12]: print depths_s2 None
everything is fine. x.fill() fills x in-place and returns nothing. So in line 11, you created an array, filled it with 2.e5, assigned the return value of fill() (=None) to depths_s2 and threw the array away. HTH, Johannes
participants (2)
-
George Nurser -
Johannes Loehnert