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 Docstring: y = equal(x1,x2) returns elementwise x1 == x2 in a bool array
Tom Denniston wrote:
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?
No bug. Ufuncs do not work with variable-sized arrays. However, we have implemented the equal operator using a different approach. -Travis
got it. thanks. On 2/7/07, Travis Oliphant <oliphant@ee.byu.edu> wrote:
Tom Denniston wrote:
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?
No bug. Ufuncs do not work with variable-sized arrays. However, we have implemented the equal operator using a different approach.
-Travis
_______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
participants (2)
-
Tom Denniston
-
Travis Oliphant