Skip to content

Operator precedence table in 5.15 should be highest to lowest precedence #69109

Closed as not planned

Description

@JosephSchachner
BPO 24921
Nosy @smontanaro, @terryjreedy, @skrah, @amaajemyfren
PRs
  • bpo-24921 Operator precedence table should be highest to lowest precedence #20572
  • 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 = None
    closed_at = None
    created_at = <Date 2015-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 = <Date 2020-06-01.15:36:04.001>
    user = 'https://bugs.python.org/JosephSchachner'

    bugs.python.org fields:

    activity = <Date 2020-06-01.15:36:04.001>
    actor = 'amaajemyfren'
    assignee = 'docs@python'
    closed = False
    closed_date = None
    closer = None
    components = ['Documentation']
    creation = <Date 2015-08-24.13:08:32.694>
    creator = 'Joseph Schachner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 24921
    keywords = ['patch']
    message_count = 4.0
    messages = ['249046', '249051', '249056', '249057']
    nosy_count = 6.0
    nosy_names = ['skip.montanaro', 'terry.reedy', 'skrah', 'docs@python', 'Joseph Schachner', 'amaajemyfren']
    pr_nums = ['20572']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue24921'
    versions = ['Python 3.6', 'Python 3.7', 'Python 3.8', 'Python 3.9', 'Python 3.10']

    Activity

    1. JosephSchachner commented on Aug 24, 2015

      JosephSchachnermannequin
      MannequinAuthor

      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?"

    2. skrah commented on Aug 24, 2015

      skrahmannequin
      Mannequin

      Yacc uses low to high.

    3. smontanaro commented on Aug 24, 2015

      @smontanaro
      Contributor

      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.

    4. skrah commented on Aug 24, 2015

      skrahmannequin
      Mannequin

      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.

    5. transferred this issue fromon Apr 10, 2022
    6. added
      3.11only security fixes
      3.12only security fixes
      and removed on Jun 20, 2022
    7. added
      3.13only security fixes
      and removed on May 13, 2023
    8. EJammy commented on Jun 14, 2023

      @EJammy

      I'm pretty sure this is a duplicate of #88003 and already changed by #25469 and #25472. Can someone confirm and close this issue?

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.11only security fixes3.12only security fixes3.13only security fixesdocsDocumentation in the Doc direasy

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions