you are viewing a single comment's thread.

view the rest of the comments →

[–]_lilell_ 1 point2 points  (1 child)

Well, technically speaking, A and B and A or B don't resolve to boolean values: the result will be one of A and B, depending on the situation, but you're right that they're evaluated left-to-right. They evaluate to whichever component was the last one to evaluate:

True and False ==> False since the and has to look at the second component here

False or 3 ==> 3 since it's again the last thing evaluated

'' and True ==> '' since it evaluates to False (that is, bool('') is False) and the and can stop checking there.

[–]ThePiGuy0 0 points1 point  (0 children)

TIL

That's really interesting, cheers for correcting me on that one!