[issue24921] Operator precedence table in 5.15 should be highest to lowest precedence
New submission from Joseph Schachner: 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_precede... 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?" ---------- assignee: docs@python components: Documentation messages: 249046 nosy: Joseph Schachner, docs@python priority: normal severity: normal status: open title: Operator precedence table in 5.15 should be highest to lowest precedence versions: Python 2.7 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue24921> _______________________________________
Stefan Krah added the comment: Yacc uses low to high. ---------- nosy: +skrah _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue24921> _______________________________________
Skip Montanaro added the comment: 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. ---------- nosy: +skip.montanaro _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue24921> _______________________________________
Stefan Krah added the comment: 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. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue24921> _______________________________________
Changes by Terry J. Reedy <tjreedy@udel.edu>: ---------- nosy: +terry.reedy _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue24921> _______________________________________
Change by Serhiy Storchaka <storchaka+cpython@gmail.com>: ---------- versions: +Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9 -Python 2.7 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue24921> _______________________________________
Change by Ama Aje My Fren <amaajemyfren@gmail.com>: ---------- keywords: +patch nosy: +amaajemyfren nosy_count: 5.0 -> 6.0 pull_requests: +19812 stage: -> patch review pull_request: https://github.com/python/cpython/pull/20572 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue24921> _______________________________________
participants (6)
-
Ama Aje My Fren
-
Joseph Schachner
-
Serhiy Storchaka
-
Skip Montanaro
-
Stefan Krah
-
Terry J. Reedy