Can somebody explain the reasoning behind the following tests ??
>>> 1 and True True >>> {'foo': 'Foo'} and True True >>> {} and True {} >>>
Python doesn't have a boolean and or boolean or. Its and and or operators are coalescing, which means that they return the first non-true or true operand, or the second operand.
and
or
1.4m articles
1.4m replys
5 comments
57.0k users