[Numpy-discussion] bug in numpy.equal?

Tom Denniston tom.denniston@alum.dartmouth....
Tue Feb 6 18:09:20 CST 2007

The behavior below seems strange to me.  The string array is type S3
yet it says that comparison with 'abc' is not implemented.  The ==
operator seems to work though.  Is there a subtlty I am missing or is
it simply a bug?

In [1]: import numpy

In [2]: numpy.equal(numpy.array(['abc', 'def']), 'abc')

Out[2]: NotImplemented

In [3]: numpy.array(['abc', 'def']) == 'abc'

Out[3]: array([ True, False], dtype=bool)

In [4]: numpy.equal?

Type:           ufunc

Base Class:     <type 'numpy.ufunc'>

String Form:    <ufunc 'equal'>

Namespace:      Interactive


    y = equal(x1,x2) returns elementwise x1 == x2 in a bool array

More information about the Numpy-discussion mailing list