Truthiness
random832 at fastmail.us
random832 at fastmail.us
Thu Oct 23 11:24:43 EDT 2014
More information about the Python-list mailing list
Thu Oct 23 11:24:43 EDT 2014
- Previous message (by thread): Truthiness
- Next message (by thread): Truthiness
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, Oct 23, 2014, at 10:56, Simon Kennedy wrote: > Thanks everyone. That's a thorough enough explanation for me. You should know, though, that numeric values equal to 1 (and 0 for False) _are_ == True. This works for dictionary keys, array indexes, etc. The bool type is actually a subclass of int. Mathematical operations on it will simply return an int, or float for division - logical operations and bitwise and/or/xor return bool (bitwise not returns an int because it returns the values -1 and -2) So checking if something is == True is the same as checking if it's == 1, and checking if it's == False is the same as checking if it's == 0.
- Previous message (by thread): Truthiness
- Next message (by thread): Truthiness
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list