Re: [Numpy-discussion] Checking for views (was: Should arr.diagonal() return a copy or aview?)

2012-05-25 Thread Nathaniel Smith
On Fri, May 25, 2012 at 4:59 PM, Robert Kern wrote: > On Fri, May 25, 2012 at 3:55 PM, Nathaniel Smith wrote: >> On May 25, 2012 2:21 PM, "Robert Kern" wrote: >>> >>> On Thu, May 24, 2012 at 5:52 PM, Robert Kern wrote: >>> >>> > (Hmm, now that I think about it, the edge cases are when the strid

Re: [Numpy-discussion] Checking for views (was: Should arr.diagonal() return a copy or aview?)

2012-05-25 Thread Robert Kern
On Fri, May 25, 2012 at 3:55 PM, Nathaniel Smith wrote: > On May 25, 2012 2:21 PM, "Robert Kern" wrote: >> >> On Thu, May 24, 2012 at 5:52 PM, Robert Kern wrote: >> >> > (Hmm, now that I think about it, the edge cases are when the strides >> > are 0 or negative. 0-stride axes can simply be remov

Re: [Numpy-discussion] Checking for views (was: Should arr.diagonal() return a copy or aview?)

2012-05-25 Thread Robert Kern
On Fri, May 25, 2012 at 3:55 PM, Nathaniel Smith wrote: > On May 25, 2012 2:21 PM, "Robert Kern" wrote: >> >> On Thu, May 24, 2012 at 5:52 PM, Robert Kern wrote: >> >> > (Hmm, now that I think about it, the edge cases are when the strides >> > are 0 or negative. 0-stride axes can simply be remov

Re: [Numpy-discussion] Checking for views (was: Should arr.diagonal() return a copy or aview?)

2012-05-25 Thread Nathaniel Smith
On May 25, 2012 2:21 PM, "Robert Kern" wrote: > > On Thu, May 24, 2012 at 5:52 PM, Robert Kern wrote: > > > (Hmm, now that I think about it, the edge cases are when the strides > > are 0 or negative. 0-stride axes can simply be removed, and I think we > > should be able to work back to a first it

Re: [Numpy-discussion] Checking for views

2012-05-25 Thread Dag Sverre Seljebotn
On 05/25/2012 03:17 PM, Robert Kern wrote: > On Thu, May 24, 2012 at 5:52 PM, Robert Kern wrote: > >> (Hmm, now that I think about it, the edge cases are when the strides >> are 0 or negative. 0-stride axes can simply be removed, and I think we >> should be able to work back to a first item and fl

Re: [Numpy-discussion] Checking for views (was: Should arr.diagonal() return a copy or aview?)

2012-05-25 Thread Robert Kern
On Thu, May 24, 2012 at 5:52 PM, Robert Kern wrote: > (Hmm, now that I think about it, the edge cases are when the strides > are 0 or negative. 0-stride axes can simply be removed, and I think we > should be able to work back to a first item and flip the sign on the > negative strides. The typica

Re: [Numpy-discussion] Checking for views (was: Should arr.diagonal() return a copy or aview?)

2012-05-24 Thread josef . pktd
On Thu, May 24, 2012 at 1:59 PM, Nathaniel Smith wrote: > On Thu, May 24, 2012 at 6:07 PM, Larsen, Brian A wrote: >> This is the stack overflow discussion mentioned. >> >> http://stackoverflow.com/questions/9164269/can-you-tell-if-an-array-is-a-view-of-another >> >> I basically implemented the an

Re: [Numpy-discussion] Checking for views (was: Should arr.diagonal() return a copy or aview?)

2012-05-24 Thread Nathaniel Smith
On Thu, May 24, 2012 at 6:07 PM, Larsen, Brian A wrote: > This is the stack overflow discussion mentioned. > > http://stackoverflow.com/questions/9164269/can-you-tell-if-an-array-is-a-view-of-another > > I basically implemented the answer from SO.  I feel like the "is" gives you > a good handle on

Re: [Numpy-discussion] Checking for views (was: Should arr.diagonal() return a copy or aview?)

2012-05-24 Thread Larsen, Brian A
This is the stack overflow discussion mentioned. http://stackoverflow.com/questions/9164269/can-you-tell-if-an-array-is-a-view-of-another I basically implemented the answer from SO. I feel like the "is" gives you a good handle on things since to be true they are actually the same location in m

Re: [Numpy-discussion] Checking for views (was: Should arr.diagonal() return a copy or aview?)

2012-05-24 Thread Robert Kern
On Thu, May 24, 2012 at 4:10 PM, Nathaniel Smith wrote: > On Thu, May 24, 2012 at 3:56 PM, Jonathan T. Niehof wrote: >> On 05/23/2012 05:31 PM, T J wrote: >> >>> It seems that there are a number of ways to check if an array is a view. >>> Do we have a preferred way in the API that is guaranteed t

Re: [Numpy-discussion] Checking for views (was: Should arr.diagonal() return a copy or aview?)

2012-05-24 Thread Nathaniel Smith
On Thu, May 24, 2012 at 3:56 PM, Jonathan T. Niehof wrote: > On 05/23/2012 05:31 PM, T J wrote: > >> It seems that there are a number of ways to check if an array is a view. >> Do we have a preferred way in the API that is guaranteed to stay >> available? Or are all of the various methods "here to

Re: [Numpy-discussion] Checking for views (was: Should arr.diagonal() return a copy or aview?)

2012-05-24 Thread Benjamin Root
On Thu, May 24, 2012 at 10:56 AM, Jonathan T. Niehof wrote: > On 05/23/2012 05:31 PM, T J wrote: > > > It seems that there are a number of ways to check if an array is a view. > > Do we have a preferred way in the API that is guaranteed to stay > > available? Or are all of the various methods "her

[Numpy-discussion] Checking for views (was: Should arr.diagonal() return a copy or aview?)

2012-05-24 Thread Jonathan T. Niehof
On 05/23/2012 05:31 PM, T J wrote: > It seems that there are a number of ways to check if an array is a view. > Do we have a preferred way in the API that is guaranteed to stay > available? Or are all of the various methods "here to stay"? We've settled on checking array.base, which I think was t