The and
and or
operators do return one of their operands, not a pure boolean value like True
or False
:
>>> 0 or 42
42
>>> 0 and 42
0
Whereas not
always returns a pure boolean value:
>>> not 0
True
>>> not 42
False
The and
and or
operators do return one of their operands, not a pure boolean value like True
or False
:
>>> 0 or 42
42
>>> 0 and 42
0
Whereas not
always returns a pure boolean value:
>>> not 0
True
>>> not 42
False