[SciPy-dev] array logical ops error?
oliphant at ee.byu.edu
Mon Oct 31 11:26:26 CST 2005
Alan G Isaac wrote:
>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.
This is a Python deal. It would be nice if b and c did the same thing
as b * c, but Python does not allow overloading of the "and" and "or"
operators (A PEP to say it should would be possible).
Thus, "b and c" evaluates the truth of b and the truth of c as a whole
(not elementwise), and there is no way to over-ride this.
More information about the Scipy-dev