[SciPy-dev] array logical ops error?

Robert Cimrman cimrman3 at ntc.zcu.cz
Mon Oct 31 04:39:19 CST 2005


Hi all,

is this the expected behaviour?
IMHO (b * c) == (b and c), (b + c) == (b or c) should hold...

In [1]:import scipy
In [2]:print scipy.__scipy_version__
0.4.2_1407
In [3]:print scipy.__core_version__
0.4.3.1401

In [4]:a = scipy.array( [1,2,3,4] )
In [5]:a
Out[5]:array([1, 2, 3, 4])

In [6]:b = a == 3
In [7]:b
Out[7]:array([False, False, True, False], dtype=bool)

In [8]:c = a > 3
In [9]:c
Out[9]:array([False, False, False, True], dtype=bool)

In [10]:b and c
Out[10]:array([False, False, False, True], dtype=bool)

In [11]:b * c
Out[11]:array([False, False, False, False], dtype=bool)

In [12]:b or c
Out[12]:array([False, False, True, False], dtype=bool)

In [13]:b + c
Out[13]:array([False, False, True, True], dtype=bool)

r.




More information about the Scipy-dev mailing list