[Numpy-discussion] immediate fill after empty gives None. (original) (raw)
Johannes Loehnert a.u.r.e.l.i.a.n at gmx.net
Fri Jun 30 05:13:22 EDT 2006
- Previous message (by thread): [Numpy-discussion] immediate fill after empty gives None.
- Next message (by thread): [Numpy-discussion] Time for beta1 of NumPy 1.0 (fwd)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
Opteron 64-bit, r2631 SVN.
In [4]: depthss2 = empty(shape=(5,),dtype=float) In [5]: depthss2.fill(2.e5) In [6]: depthss2 Out[6]: array([ 200000., 200000., 200000., 200000., 200000.]) In [11]: depthss2 = (empty(shape=(5,),dtype=float)).fill(2.e5) In [12]: print depthss2 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
- Previous message (by thread): [Numpy-discussion] immediate fill after empty gives None.
- Next message (by thread): [Numpy-discussion] Time for beta1 of NumPy 1.0 (fwd)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]