Re: [Numpy-discussion] Inplace reshape

2007-04-23 Thread Robert Kern
Christopher Barker wrote: > if numpy.reshape() is delegating to ndarray.reshape() couldn't they > share docstrings somehow? Yes, of course. I got bored halfway through the conversions and didn't get to doing the methods. If you want to speed up the process, please submit a patch. -- Robert Ker

Re: [Numpy-discussion] Inplace reshape

2007-04-23 Thread Christopher Barker
Keith Goodman wrote: > At the moment numpy.reshape and array.reshape have different doc > strings (I'm using numpy 1.0.2.dev3546). The one I pasted is from > numpy.reshape. And I see from there: :See also: numpy.ndarray.reshape() is the equivalent method. so it looks like they are th

Re: [Numpy-discussion] Inplace reshape

2007-04-23 Thread Keith Goodman
On 4/23/07, Christopher Barker <[EMAIL PROTECTED]> wrote: > Charles R Harris wrote: > > Here's a better doc string that explains "This will be a new view > > object if possible; otherwise, it will return a copy." > > Does this exist somewhere, or are you contributing it now? At the moment

Re: [Numpy-discussion] Inplace reshape

2007-04-23 Thread Christopher Barker
Charles R Harris wrote: > Here's a better doc string that explains "This will be a new view > object if possible; otherwise, it will return a copy." Does this exist somewhere, or are you contributing it now? > I think that it should raise an error, or warn, if it needs to make a > copy,

Re: [Numpy-discussion] Inplace reshape

2007-04-23 Thread Charles R Harris
On 4/23/07, Keith Goodman <[EMAIL PROTECTED]> wrote: On 4/23/07, Christopher Barker <[EMAIL PROTECTED]> wrote: > reshape(...) > a.reshape(d1, d2, ..., dn, order='c') > > Return a new array from this one. The new array must have the same > > number of elements as self. Also alway

Re: [Numpy-discussion] Inplace reshape

2007-04-23 Thread Keith Goodman
On 4/23/07, Christopher Barker <[EMAIL PROTECTED]> wrote: > reshape(...) > a.reshape(d1, d2, ..., dn, order='c') > > Return a new array from this one. The new array must have the same > > number of elements as self. Also always returns a view or raises a > ValueError if that i

Re: [Numpy-discussion] Inplace reshape

2007-04-23 Thread Charles R Harris
On 4/23/07, Christopher Barker <[EMAIL PROTECTED]> wrote: Gael Varoquaux wrote: > Unless I miss something obvious "a.reshape()" doesn't modify a, which is > somewhat missleading, IMHO. quite correct. .reshape() creates a new array that shared data with the original: Sometimes it do, sometime

Re: [Numpy-discussion] Inplace reshape

2007-04-23 Thread Pierre GM
On Monday 23 April 2007 13:36:26 Christopher Barker wrote: > Gael Varoquaux wrote: > > Unless I miss something obvious "a.reshape()" doesn't modify a, which is > > somewhat missleading, IMHO. > > quite correct. .reshape() creates a new array that shared data with the > original: Mmh. My understand

Re: [Numpy-discussion] Inplace reshape

2007-04-23 Thread Christopher Barker
Gael Varoquaux wrote: > Unless I miss something obvious "a.reshape()" doesn't modify a, which is > somewhat missleading, IMHO. quite correct. .reshape() creates a new array that shared data with the original: >>> import numpy >>> a = numpy.zeros((2,3)) >>> help(a.reshape) Help on built-in fu

Re: [Numpy-discussion] Inplace reshape

2007-04-23 Thread Robert Kern
Gael Varoquaux wrote: > On Mon, Apr 23, 2007 at 12:20:51PM -0500, Robert Kern wrote: >> .reshape() > > Unless I miss something obvious "a.reshape()" doesn't modify a, which is > somewhat missleading, IMHO. Nope, you caught me in a moment of stupidity. -- Robert Kern "I have come to believe tha

Re: [Numpy-discussion] Inplace reshape

2007-04-23 Thread Gael Varoquaux
On Mon, Apr 23, 2007 at 10:20:43AM -0700, Timothy Hochberg wrote: >Just set the shape of the array: >somearray.shape = newshape Of course ! Thanks On Mon, Apr 23, 2007 at 12:20:51PM -0500, Robert Kern wrote: > .reshape() Unless I miss something obvious "a.reshape()" doesn't modify a

Re: [Numpy-discussion] Inplace reshape

2007-04-23 Thread Robert Kern
Gael Varoquaux wrote: > Hi, > > I thought I remembered there was a way to reshape in-place an array, but > neither google, nor greping my mailbox brings anything out. > Am I wrong, or is there indeed a way to reshape in-place an array ? .reshape() -- Robert Kern "I have come to believe that th

Re: [Numpy-discussion] Inplace reshape

2007-04-23 Thread Timothy Hochberg
On 4/23/07, Gael Varoquaux <[EMAIL PROTECTED]> wrote: Hi, I thought I remembered there was a way to reshape in-place an array, but neither google, nor greping my mailbox brings anything out. Am I wrong, or is there indeed a way to reshape in-place an array ? Just set the shape of the array:

Re: [Numpy-discussion] Inplace reshape

2007-04-23 Thread Anne Archibald
On 23/04/07, Gael Varoquaux <[EMAIL PROTECTED]> wrote: > Hi, > > I thought I remembered there was a way to reshape in-place an array, but > neither google, nor greping my mailbox brings anything out. > Am I wrong, or is there indeed a way to reshape in-place an array ? Sometimes it's just impossib

[Numpy-discussion] Inplace reshape

2007-04-23 Thread Gael Varoquaux
Hi, I thought I remembered there was a way to reshape in-place an array, but neither google, nor greping my mailbox brings anything out. Am I wrong, or is there indeed a way to reshape in-place an array ? Cheers, Gaƫl ___ Numpy-discussion mailing list