Understanding Logical Operator Precedence in Python