On Thu, May 24, 2012 at 10:56 AM, Jonathan T. Niehof <jniehof@lanl.gov> 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 stay"?

We've settled on checking array.base, which I think was the outcome of a
stackoverflow thread that I can't dig up. (I'll check with the guy who
wrote the code.)


Just as a quick word to the wise.  I think I can recall a situation where this could be misleading.  In particular, I think it had to do with boolean/fancy indexing of an array.  In some cases, what you get is a view of the copy of the original data.  So, if you simply check to see if it is a view, and then assume that because it is a view, it must be a view of the original data, then that assumption can come back and bite you in strange ways.

Cheers!
Ben Root