Numeric array in unittest problem

Robert Kern robert.kern at
Mon Nov 21 18:59:18 CET 2005

Alex Martelli wrote:

>>>>import Numeric
>>>>c = a==b
> array([1, 0])
> i.e., thanks to element-by-element evaluation, == will generally return
> a true value for ANY comparison of Numeric arrays, causing a very
> frequent beginner's bug to be sure.

Indeed. This is why numarray and scipy_core have made arrays raise an
exception when someone tries to use them as truth values.

Robert Kern
robert.kern at

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter

More information about the Python-list mailing list