Python's and-or  operation