[MATRIX-SIG] umath.logical_blah vs normal python functions.

Zane C. Motteler motteler@laura.llnl.gov
Tue, 18 Nov 1997 10:42:35 -0800 (PST)


David,

On Tue, 18 Nov 1997, you wrote:

>> is there any reason for this difference in behaviour? It's unexpected
>> (well, it was unexpected by me :) 
>> 
>> >>> umath.logical_and(4,5)
>> 1
>> >>> 4 and 5
>> 5
>
>Try:
>
>  >>> umath.boolean_and(4,5)
>
>logical_and returns 0 or 1, boolean_and works like Python's 'and'
>construct.
>
>--da

Yes, but the boolean_and of 4 and 5 is 4. It is incomprehensible how the
'4 and 5' construct comes up with 5. Incidentally, '4 or 5' comes out 4.
Perhaps the parser has inadvertently interchanged the 'and' and 'or'
operators???

Zane

-----------------------------------------------------------------------------
Zane C. Motteler, Ph. D.                  ___________ALSO:_________________
Computer Scientist                        | Professor Emeritus of Computer|
Lawrence Livermore National Laboratory    |   Science and Engineering     |
P O Box 808, L-472                        | California Polytechnic State  |
Livermore, CA 94551-9900                  |   University, San Luis Obispo |
510/423-2143                              ---------------------------------
FAX 510/423-9969
zcm@llnl.gov or motteler@laura.llnl.gov or zmottel@calpoly.edu


_______________
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________