Numeric don't compare arrays correctly

Fernando Perez fperez528 at yahoo.com
Fri Jun 6 00:04:59 CEST 2003


Maurix wrote:

> I have a problem with Numeric: (linux, python2.2, numeric 21.0)
> 
> It seem that don't compare correctly arrays.

It's not really a bug in numeric, but rather a quirk you'll have to get used to:

In [6]: logical_and(a>2.,a<4.)
Out[6]: array([0, 1, 1, 0, 0])

The problem is that and/or can't be overloaded.  So Numeric provides a familiy
of logical_* functions for this purpose:

logical_and  logical_not  logical_or   logical_xor

cheers,

f.




More information about the Python-list mailing list