Tim Peters <t...@python.org> added the comment:
@sangeetamchauhan, the reply you got in the image you attached was in error - kind of. Section "6.16. Operator precedence" defines Python's operator precedence: https://docs.python.org/3/reference/expressions.html#index-92 """ The following table summarizes the operator precedence in Python, from lowest precedence (least binding) to highest precedence (most binding). """ As you can see there, "and" and "or" are very near the top of the table, so bind very weakly - almost anything else on either side gets evaluated first. In particular, all comparison operators bind more tightly than "and" and "or". It's the bitwise operators (| & ^) that bind more tightly than comparisons. I asked at the start "What do you expect?" but you never answered. You just keep repeating that it's wrong. Sorry, but I still have no idea what you think "should" happen instead. As I also said the start, 9 or 7 > "str" groups as 9 or (7 > "str") exactly as the operator precedence table says it should, and returns 9, exactly as the docs for "or" say it should do. What about that do you think is wrong? Please be very specific, and back your answer with a reference to what the docs actually say. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38060> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com