Short-circuit Logic

Steven D'Aprano steve+comp.lang.python at pearwood.info
Tue May 28 11:55:42 EDT 2013


On Tue, 28 May 2013 15:14:03 +0000, Grant Edwards wrote:

> On 2013-05-28, Steven D'Aprano <steve+comp.lang.python at pearwood.info>
> wrote:
>> On Tue, 28 May 2013 01:39:09 -0700, Ahmed Abdulshafy wrote:
>>
>>> He just said that the way to test for zero equality is x == 0, and I
>>> meant that this is true for integers but not necessarily for floats.
>>> And that's not specific to Python.
>>
>> Can you show me a value of x where x == 0.0 returns False, but x
>> actually isn't zero?
> 
> I'm confused.  Don't all non-zero values satisfy your conditions?

Of course they do :-(

I meant "but x actually *is* zero". Sorry for the confusion. I blame the 
terrists.



-- 
Steven



More information about the Python-list mailing list