[Numpy-discussion] str == int puzzlement

Sturla Molden sturla at molden.no
Wed Jul 28 22:15:02 EDT 2010


> I'll call this a bug in NumPy's broadcasting. "x == 1" should have
> returned:

This is probably related:


In [22]: a = np.array(['a','b'])

In [23]: a + 'c'
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

C:\Windows\system32\<string> in <module>()

TypeError: unsupported operand type(s) for +: 'numpy.ndarray' and 'str'

In [24]: a + 1
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

C:\Windows\system32\<string> in <module>()

TypeError: unsupported operand type(s) for +: 'numpy.ndarray' and 'int'



Operator + not supported for types numpy.ndarray and int???

I think a ticket on the bug tracker is due.


Sturla











More information about the NumPy-Discussion mailing list