First Mystery of Strings:
How come bool('foo') returns True?
if
'foo' == TruereturnsFalse
'foo' == FalsereturnsFalse
'foo' is TruereturnsFalse
'foo' is FalsereturnsFalse
Second Mystery of Integers:
How come bool(5) returns True?
if
5 == TruereturnsFalse
5 == FalsereturnsFalse
5 is TruereturnsFalse
5 is FalsereturnsFalse
Third Mystery of Zeros:
How come bool(0) returns False?
if
0 == TruereturnsFalse
0 == FalsereturnsTrue<-- Special Case
0 is TruereturnsFalse
0 is FalsereturnsFalse
I am aware of some of the truthiness of Python, however, this all seems a bit mysterious. Someone mind shedding some light on this?