[Numpy-discussion] __eq__ with str and object

Keith Goodman kwgoodman at gmail.com
Tue May 25 12:54:11 EDT 2010


I don't understand this:

>> a1 = np.array(['a', 'b'], dtype=object)
>> a2 = np.array(['a', 'b'])
>>
>> a1 == a2
   array([ True,  True], dtype=bool)  # Looks good
>> a2 == a1
   False  # Should I have expected this?

This works like I expected:

>> a1 = np.array([1, 2], dtype=object)
>> a2 = np.array([1, 2])
>>
>> a1 == a2
   array([ True,  True], dtype=bool)
>> a2 == a1
   array([ True,  True], dtype=bool)



More information about the NumPy-Discussion mailing list