[SciPy-dev] array logical ops error?

Alan G Isaac aisaac at american.edu
Mon Oct 31 07:37:31 EST 2005


On Mon, 31 Oct 2005, Robert Cimrman apparently wrote: 
> is this the expected behaviour? 
> IMHO (b * c) == (b and c), (b + c) == (b or c) should hold... 

I expected the Boolean operations to yield  
element-by-element comparisons.  What are they??  In 
contrast, the + and * operators give the expected results.

>>> a=scipy.array([1,2,3,4])
>>> b= a==3
>>> c= a>3
>>> b
array([False, False, True, False], dtype=bool)
>>> c
array([False, False, False, True], dtype=bool)
>>> b and c
array([False, False, False, True], dtype=bool)
>>> b or c
array([False, False, True, False], dtype=bool)

Cheers,
Alan Isaac 





More information about the SciPy-Dev mailing list