[Numpy-discussion] Funny business with 'is' operator?

James Bergstra bergstrj at iro.umontreal.ca
Fri Sep 6 12:19:08 EDT 2013

Hi, could someone help me understand why this assertion fails?

def test_is(self):
    a = np.empty(1)
    b = np.empty(1)
    if a.data is not b.data:
        assert id(a.data) != id(b.data) # <-- fail

I'm trying to write an alternate may_share_memory function.

 - James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20130906/614cc758/attachment.html>

More information about the NumPy-Discussion mailing list