[Numpy-discussion] Getting an array interface and using it

2007-11-12 Thread Matthieu Brucher
Hi, I have an object that exposes an array interface. I want to modify the data it contains, but using numpy.array(myObject) seems to copy the data and thus my object is not modified. Am I mistaken or did I make a mistake in my array interface ? Matthieu -- French PhD student Website :

Re: [Numpy-discussion] Getting an array interface and using it

2007-11-12 Thread Christopher Barker
Matthieu Brucher wrote: I have an object that exposes an array interface. I want to modify the data it contains, but using numpy.array(myObject) seems to copy the data and thus my object is not modified. Am I mistaken or did I make a mistake in my array interface ? I think

Re: [Numpy-discussion] Getting an array interface and using it

2007-11-12 Thread Matthieu Brucher
2007/11/12, Christopher Barker [EMAIL PROTECTED]: Matthieu Brucher wrote: I have an object that exposes an array interface. I want to modify the data it contains, but using numpy.array(myObject) seems to copy the data and thus my object is not modified. Am I mistaken or did I make a

Re: [Numpy-discussion] Getting an array interface and using it

2007-11-12 Thread Pierre GM
I think numpy.array(object) always makes a copy. You want numpy.asarray(object) which will make a view if object exposes the array interface and matches the type and sizes requested. FYI, numpy.asarray is a shortcut for numpy.array(copy=False), numpy.asanyarray for