[Numpy-discussion] str == int puzzlement

Matthew Brett matthew.brett@gmail....
Thu Jul 29 03:13:59 CDT 2010


Hi,

On Wed, Jul 28, 2010 at 6:49 PM, John Salvatier
<jsalvati@u.washington.edu> wrote:
> I think this is just Python behavior; comparing python ints and strs also
> gives False:
>
> In [45]: 8 == 'L'
> Out[45]: False

Just to be clear, from:

>>> a = np.array(['a','b'])
>>> a == 1

I was expecting:

array([ False, False], dtype=bool)

For:

> In [22]: a = np.array(['a','b'])
>
> In [23]: a + 'c'

etc - it makes sense to me that I can't add to numpy strings.

Best,

Matthew


More information about the NumPy-Discussion mailing list