[New-bugs-announce] [issue45646] The documentation wrongly uses or_expr for star expresion in displays

Arthur Milchior report at bugs.python.org
Thu Oct 28 10:42:22 EDT 2021


New submission from Arthur Milchior <arthur at milchior.fr>:

According to the current documentation, I believe there is an error in
list_display, set_display and dict_display.
According to list display, this is a valid expression
[* l1 ^ l2]
parsed as
list_display:
  "["
  starred_list:
    starred_item:
      "*"
      or_expr:
        xor_expr:
          xor_expr: "l1"
          "^"
          and_expr: "l2"
  "]"  

I add the full derivation from and_expr to l2 at the end of the report, it's not important for this topic. 

The same issue is present for set. For dictionary it is also present, but instead the error is in key_datum.

I have no idea what would be the proper correction.
Indeed [*l1+l2] is valid (in 3.9) at least. So it's not like the element after a star is restricted to be an atom.

At the very least, I believe it should be clearly indicated that, contrary to what the name indicates, "or_expr" do not mean that we accept any or, nor any expression. It just mean that 
*some_complex_expression
is interpreted as
* (some_complex_expression)
and that it is valid iff some_complex_expression is valid



            shift_expr:
              a_expr:
                m_expr:
                  power:
                    primary:
                      atom:
                        identifier:
                          "l2"

----------
assignee: docs at python
components: Documentation
messages: 405187
nosy: Arthur-Milchior, docs at python
priority: normal
severity: normal
status: open
title: The documentation wrongly uses or_expr for star expresion in displays
versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 3.9

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


More information about the New-bugs-announce mailing list