[Numpy-discussion] bug in comparing object arrays to None (?)

Charles G. Waldman charles at crunch.io
Mon Jan 27 15:43:30 EST 2014


Hi Numpy folks.

I just noticed that comparing an array of type 'object' to None does
not behave as I expected.  Is this a feature or a bug?  (I can take a
stab at fixing it if it's a bug, as I believe it is).

>>> np.version.full_version
'1.8.0'

>>> a = np.array(['Frank', None, 'Nancy'])

>>> a
array(['Frank', None, 'Nancy'], dtype=object)

>>> a == 'Frank'
array([ True, False, False], dtype=bool)
# Return value is an array

>>> a == None
False
# Return value is scalar (BUG?)



More information about the NumPy-Discussion mailing list