[Edu-sig] Truth values and comparisons
Arthur
ajsiegel at optonline.net
Mon Oct 30 18:40:55 CET 2006
John Zelle wrote:
>On Monday 30 October 2006 10:49 am, Arthur wrote:
>
>
>>
>>thanks, but having some trouble:
>> >>> import Numeric as N
>> >>> a=N.array([0,0,0])
>> >>> b=N.array([0,0,1])
>> >>> a and b
>>
>>array([0, 0, 0])
>>
>>
>
>This tells me that a zero array is being treated as False (the logical
>extension to arrays of 0 being false.
>
>
>> >>> b and a
>>
>>array([0, 0, 0])
>>
>>
>
>Right. In both cases, the answer is False, which Python gives to you by
>handing you the first False expression.
>
Ah. that is what I was missing, returns the first *False* expression. I
was interpreting Dave
to say that it returns the first expression, period.
With that, things fall into place.
Thanks,
Art
More information about the Edu-sig
mailing list