[New-bugs-announce] [issue39834] + vs. % operator precedence not correct

E report at bugs.python.org
Tue Mar 3 03:44:30 EST 2020


New submission from E <ergun920 at live.com>:

+ 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.

----------
components: Interpreter Core
messages: 363241
nosy: ergun
priority: normal
severity: normal
status: open
title: + vs. % operator precedence not correct
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39834>
_______________________________________


More information about the New-bugs-announce mailing list