Operator Precedence/Boolean Logic

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu Jun 23 03:05:36 EDT 2016


On Thursday 23 June 2016 16:34, Andreas Röhler wrote:

> Indeed, why should the result of 4 - 4 have a different truth-value than
> 4 - 3 ?

Because 4-4 is zero, which is "nothing", while 4-3 is one, which is 
"something".

You might as well ask why False and True have different truth values. 
Ironically, in a manner of speaking you *did* ask that, since 4-3 == True and 
4-4 == False.


-- 
Steve



More information about the Python-list mailing list