[Numpy-discussion] 0d array value comparisons
Thomas J. Duck
Fri Jul 25 12:42:05 CDT 2008
There is some unexpected behaviour (to me) when 0-dimensional
arrays are compared with values. For example:
>>> numpy.array().squeeze() == 0
>>> numpy.array([None]).squeeze() == None
>>> numpy.array(['a']).squeeze() == 'a'
Note that each test follows the same pattern, although the dtype for
each squeezed array is different. The first case result is what I
expected, and the second case result appears wrong. The return type
for the third case is inconsistent with those before, but is at least
Are these the intended results?
Thomas J. Duck <email@example.com>
Department of Physics and Atmospheric Science, Dalhousie University,
Halifax, Nova Scotia, Canada, B3H 3J5.
Tel: (902)494-1456 | Fax: (902)494-5191 | Lab: (902)494-3813
More information about the Numpy-discussion