[Numpy-discussion] Inplace index suprise
Gael Varoquaux
gael.varoquaux@normalesup....
Thu Mar 20 17:54:54 CDT 2008
On Thu, Mar 20, 2008 at 06:43:21PM -0300, Lisandro Dalcin wrote:
> I think you are wrong, here THERE ARE tmp arrays involved... numpy has
> to copy data if indices are not contiguous or strides (in the sense of
> actually using a slice)
> In [1]: from numpy import *
> In [2]: A = array([0,0,0])
> In [3]: B = A[[0,1,2]]
> In [4]: print B.base
> None
> In [5]: C = A[0:3]
> In [6]: print C.base
> [0 0 0]
Indeed, you are right, I hadn't realised that. Thanks for pointing it
out.
Gaël
More information about the Numpy-discussion
mailing list