You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Operator precedence table in 5.15 should be highest to lowest precedence #69109
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2015-08-24.13:08:32.694>labels= ['3.7', '3.8', '3.9', '3.10', 'docs']
title='Operator precedence table in 5.15 should be highest to lowest precedence'updated_at=<Date2020-06-01.15:36:04.001>user='https://bugs.python.org/JosephSchachner'
We should not make people who need to read Python documentation do an extra transformation in their heads to correctly understand that in section 5.15 higher precedence is at the bottom of the table and lower precedence is at the top. Because the documentation has this table inverted from the way it is usually presented in other references, one of the top hits in a Google search shows an instructor felt the need to make a version in the usual "high to low precedence" order to show students, see: http://www.mathcs.emory.edu/~valerie/courses/fall10/155/resources/op_precedence.html
That version is so much more comfortable for me to read, it seems almost strange, but it is true. Please consider changing section 5.15 so it would not need the top paragraph explaining that the table order is not what the reader probably expects, instead just present the table as at the link above - in the order the reader does expect - higher precedence on top, lower on the bottom. That only needs two short sentences of explanation that don't make the reader think "wait ... what?"
YACC might be an outlier as well. In any case, it's probably better to use other common programming languages as a gauge of what's typical. A quick check of C, C#, C++, Java, Perl, Ruby, and Haskell shows they all list operator precedence in order from highest to lowest.
skrah commented on Aug 24, 2015
skrahmannequin
Mannequin
More actions
Agreed. I'm not sure though what the reason for this convention is:
The flow in Grammar/Grammar (low to high) feels quite natural to me.
Activity
JosephSchachner commentedon Aug 24, 2015
We should not make people who need to read Python documentation do an extra transformation in their heads to correctly understand that in section 5.15 higher precedence is at the bottom of the table and lower precedence is at the top. Because the documentation has this table inverted from the way it is usually presented in other references, one of the top hits in a Google search shows an instructor felt the need to make a version in the usual "high to low precedence" order to show students, see:
http://www.mathcs.emory.edu/~valerie/courses/fall10/155/resources/op_precedence.html
That version is so much more comfortable for me to read, it seems almost strange, but it is true. Please consider changing section 5.15 so it would not need the top paragraph explaining that the table order is not what the reader probably expects, instead just present the table as at the link above - in the order the reader does expect - higher precedence on top, lower on the bottom. That only needs two short sentences of explanation that don't make the reader think "wait ... what?"
skrah commentedon Aug 24, 2015
Yacc uses low to high.
smontanaro commentedon Aug 24, 2015
YACC might be an outlier as well. In any case, it's probably better to use other common programming languages as a gauge of what's typical. A quick check of C, C#, C++, Java, Perl, Ruby, and Haskell shows they all list operator precedence in order from highest to lowest.
skrah commentedon Aug 24, 2015
Agreed. I'm not sure though what the reason for this convention is:
The flow in Grammar/Grammar (low to high) feels quite natural to me.
That said, I'm +-0 on the change.
EJammy commentedon Jun 14, 2023
I'm pretty sure this is a duplicate of #88003 and already changed by #25469 and #25472. Can someone confirm and close this issue?