[Numpy-discussion] Comparing x and x.view

Travis Oliphant oliphant at ee.byu.edu
Wed Feb 7 23:09:16 EST 2007


Pierre GM wrote:
> On Wednesday 07 February 2007 22:38:30 Robert Kern wrote:
>   
>> Pierre GM wrote:
>>     
>>> All,
>>>
>>> I want to compare whether two arrays point to the same data.
>>> I've been using 'is' so far, but I'm wondering whether it's the right
>>> approach.
>>>       
>> It isn't. Your analysis is correct.
>>     
>
> So, there's no real point in using the Python 'id' function ? Do we need a 
> shortcut to __array_interface__['data'] as id number ?
>   
You have it (sort of a short-cut).

.ctypes.data

This works even if ctypes is not installed.

-Travis




More information about the NumPy-Discussion mailing list