[Numpy-discussion] strange behavior with a numpy array as member of a list

Robert Kern robert.kern at gmail.com
Thu Nov 30 16:18:15 CST 2006

Christopher Barker wrote:
> Robert Kern wrote:
>>> What determines if an array tests for equality as the entire array or 
>>> element-wise?
>> There are some special cases for backwards compatibility. 
> with what?
> IIRC, Numeric has raised an error for a very long time with:
> a == None #(a is a Numeric array)

In [4]: import Numeric

In [5]: a = Numeric.arange(10)

In [6]: a == None
Out[6]: array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])

> Personally, I liked it that way -- if you can't do a rich comparison, an 
> error is better than a meaningless result.

I'm just reporting what the comment in the code says.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

More information about the Numpy-discussion mailing list