Python evaluates from left to right (you can control the flow / grouping with brackets, tho), and comparison operators can be chained arbitrarily so an expression:
"a" in "bar" in "foo" in "baz"
Essentially ends up as:
"a" in "bar" and "bar" in "foo" and "foo" in "baz"
Which resolves to False.