Re: [Numpy-discussion] __eq__ with str and object

2010-05-26 Thread Keith Goodman
On Wed, May 26, 2010 at 6:11 AM, Charles R Harris wrote: > > > On Tue, May 25, 2010 at 2:21 PM, Michael Droettboom wrote: >> >> Seems like a bug to me.  Certain branches in _array_richcompare return >> False to fail rather than Py_NotImplemented, which means the >> string-understanding comparison

Re: [Numpy-discussion] __eq__ with str and object

2010-05-26 Thread Charles R Harris
On Tue, May 25, 2010 at 2:21 PM, Michael Droettboom wrote: > Seems like a bug to me. Certain branches in _array_richcompare return > False to fail rather than Py_NotImplemented, which means the > string-understanding comparison fallbacks don't run. Attached is a (simple) > patch that resolves t

Re: [Numpy-discussion] __eq__ with str and object

2010-05-25 Thread Michael Droettboom
Seems like a bug to me. Certain branches in _array_richcompare return False to fail rather than Py_NotImplemented, which means the string-understanding comparison fallbacks don't run. Attached is a (simple) patch that resolves this bug, and doesn't seem to cause any of the unit tests to fail.

[Numpy-discussion] __eq__ with str and object

2010-05-25 Thread Keith Goodman
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.ar