From: Pearu P. <pe...@ce...> - 2002-03-21 07:57:43
|
On 20 Mar 2002, Jochen K=FCpper wrote: > >>>> a > Aureli> array([0, 1, 0, 0, 1, 0, 1, 0, 0, 1]) > >>>> b > Aureli> array([1, 1, 0, 1, 0, 0, 1, 1, 1, 0]) >=20 >=20 > >>>> Numeric.logical_and(a,b) > Aureli> array([0, 1, 0, 0, 0, 0, 1, 0, 0, 0]) >=20 > This look's correct... >=20 > >>>> a and b > Aureli> array([1, 1, 0, 1, 0, 0, 1, 1, 1, 0]) >=20 > ... and this suspiciously like b. =2E. and also correct. It is default behaviour of Python `and' operation. From Python Language Reference: The expression `x and y' first evaluates `x'; if `x' is false, its value = =20 is returned; otherwise, `y' is evaluated and the resulting value is returned.=20 So, `and' operation is "object"-operation (unless redefined to something else) while logical_and is "elementwise"-operation. Pearu |