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: Fix bitwise and logical terminology in python.gram
Type: Stage: resolved
Components: Documentation Versions: Python 3.11, Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: pablogsal Nosy List: mark.dickinson, miss-islington, pablogsal, rhettinger
Priority: normal Keywords: patch

Created on 2022-01-05 18:54 by rhettinger, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 30499 merged mark.dickinson, 2022-01-09 12:11
Messages (5)
msg409796 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2022-01-05 18:54
In the section "Comparison operators", all mentions of "bitwise" should be "binary".

The section "Logical operators" should be retitled "Bitwise operators".  See: https://docs.python.org/3/reference/expressions.html#binary-bitwise-operations
msg409848 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2022-01-06 14:22
> In the section "Comparison operators", all mentions of "bitwise" should be "binary".

Should they? The corresponding line from https://docs.python.org/3/reference/expressions.html#comparisons is

    comparison    ::=  or_expr (comp_operator or_expr)*

which seems to match:

    comparison[expr_ty]:
        | a=bitwise_or b=compare_op_bitwise_or_pair+ { ... snipped ... }
        | bitwise_or

from the "Comparisons operators" section of the grammar. The next-higher-precedence operation after comparison operators is bitwise or, and the occurrences of "bitwise_or" look correct to me in this section.

We could retitle "Comparisons operators" to "Comparison operators", though.

> The section "Logical operators" should be retitled "Bitwise operators".

Agreed.
msg409887 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2022-01-06 17:28
> comparison    ::=  or_expr (comp_operator or_expr)*

So, the meaning of these names like this is, "lt followed by an optional bitwise_or expression"?

compare_op_bitwise_or_pair[CmpopExprPair*]:
    | eq_bitwise_or
    | noteq_bitwise_or
    | lte_bitwise_or
    | lt_bitwise_or
    | gte_bitwise_or
    | gt_bitwise_or
    | notin_bitwise_or
    | in_bitwise_or
    | isnot_bitwise_or
    | is_bitwise_or

eq_bitwise_or[CmpopExprPair*]: '==' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, Eq, a) }
noteq_bitwise_or[CmpopExprPair*]:
    | (tok='!=' { _PyPegen_check_barry_as_flufl(p, tok) ? NULL : tok}) a=bitwise_or {_PyPegen_cmpop_expr_pair(p, NotEq, a) }
lte_bitwise_or[CmpopExprPair*]: '<=' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, LtE, a) }
lt_bitwise_or[CmpopExprPair*]: '<' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, Lt, a) }
gte_bitwise_or[CmpopExprPair*]: '>=' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, GtE, a) }
gt_bitwise_or[CmpopExprPair*]: '>' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, Gt, a) }
notin_bitwise_or[CmpopExprPair*]: 'not' 'in' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, NotIn, a) }
in_bitwise_or[CmpopExprPair*]: 'in' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, In, a) }
isnot_bitwise_or[CmpopExprPair*]: 'is' 'not' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, IsNot, a) }
is_bitwise_or[CmpopExprPair*]: 'is' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, Is, a) }
msg410142 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2022-01-09 12:12
> So, the meaning of these names like this is, "lt followed by an optional bitwise_or expression"?

That's certainly how I was reading it.
msg410158 - (view) Author: miss-islington (miss-islington) Date: 2022-01-09 16:22
New changeset 1bee9a4625e101d3308831de37590f4e2f57c71c by Mark Dickinson in branch 'main':
bpo-46272: Fix two heading comments in python.gram (GH-30499)
https://github.com/python/cpython/commit/1bee9a4625e101d3308831de37590f4e2f57c71c
History
Date User Action Args
2022-04-11 14:59:54adminsetgithub: 90430
2022-01-09 16:43:51rhettingersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2022-01-09 16:22:58miss-islingtonsetnosy: + miss-islington
messages: + msg410158
2022-01-09 12:12:02mark.dickinsonsetmessages: + msg410142
2022-01-09 12:11:22mark.dickinsonsetkeywords: + patch
stage: patch review
pull_requests: + pull_request28706
2022-01-06 17:28:44rhettingersetmessages: + msg409887
2022-01-06 14:22:52mark.dickinsonsetnosy: + mark.dickinson
messages: + msg409848
2022-01-05 18:54:45rhettingercreate