Logic problem: need better logic for desired thruth table.

alister alister.nospam.ware at ntlworld.com
Fri May 29 07:41:38 EDT 2015


On Fri, 29 May 2015 13:48:55 +1000, Chris Angelico wrote:

> On Fri, May 29, 2015 at 1:20 PM,  <random832 at fastmail.us> wrote:
>> The possibility of spelling these with the comparison operators, as
>> some have suggested, is a consequence of Python's implementation where
>> True == 1 and False == 0. In other languages bool may not be relatable
>> (or at least not orderable), or False may be == -1.
> 
> True. That said, though, using 0 for False and 1 for True is easily the
> most common convention in use today, and the next most likely case is
> that comparing booleans would give a simple and immediate error. So it's
> most likely to be safe to do. Cross-language compatibility is a tricky
> thing anyway; there are all sorts of odd edge cases, even with
> otherwise-similar languages (Pike and Python, for instance, have
> slightly different handling of slice ranges), so anything that's done in
> Python is meant to be interpreted with Python semantics.
> 
> ChrisA

in the past True has even been -1 with 0 as false
(all bits set in a signed integer)




-- 
I use technology in order to hate it more properly.
		-- Nam June Paik



More information about the Python-list mailing list