Yes Mikel is right,can look a little at grouping of this.
So i looked a little into
comparison operator chaining
.
So my understand of this is.
>>> blue = "lm"
>>> my_size = "l"
>>> my_size in blue
True
>>> my_size in blue == True
False
>>> # Chaining (this is what comparison operators do) left to right
>>> (my_size in blue) and (blue == True)
False
>>> # So it is
>>> True and False
False
If look at grouping for non-comparison operators.
>>> 7 - 1 + 4
10
>>> # Means
>>> (7 - 1) + 4
10
>>> # Grouping right to left would give a different result
>>> 7 - (1 + 4)
2
One more with
comparison operator chaining
a < b < c
# Grouping is
(a < b) and (b < c)
The other way around:
>>> blue = "lm"
>>> my_size = "a"
>>> my_size in blue
False
>>> # Both are False
>>> my_size in blue == True
False
>>> my_size in blue == False
False
>>> # Comparison operator chaining
>>> (my_size in blue) and (blue == True)
False
>>> # So if first grouping is False,then always return False
>>> (my_size in blue)
False
>>> # Then second group is not looked at all,as first group is False
>>> (blue == True)
False
# So we never get to this
>>> False == False
True