This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: + vs. % operator precedence not correct
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: ergun
Priority: normal Keywords:

Created on 2020-03-03 08:44 by ergun, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg363241 - (view) Author: E (ergun) Date: 2020-03-03 08:44
+ has operator precedence over % in python:
https://docs.python.org/3/reference/expressions.html

However:
> i=5
> i+5 % 10
10
> 10 % 10
0
> (i+5) % 10
0

Thus, for + to take precedence over %, parentheses need to be used.
msg363243 - (view) Author: E (ergun) Date: 2020-03-03 08:49
Actually, the operator precedence is read upside down:
https://docs.python.org/3/reference/expressions.html

Thus, % has operator precedence and this might be causing the incorrect values.
History
Date User Action Args
2022-04-11 14:59:27adminsetgithub: 84015
2020-03-03 09:21:33ergunsetstatus: open -> closed
resolution: not a bug
stage: resolved
2020-03-03 08:49:21ergunsetmessages: + msg363243
2020-03-03 08:44:30erguncreate