Chained comparison operators in python