cpython/Doc/reference
Miss Islington (bot) c6f3f83d88
[3.12] gh-115528: Update language reference for PEP 646 (GH-121181) (#124633)
gh-115528: Update language reference for PEP 646 (GH-121181)

To recap: the objective is to make starred expressions valid in `subscription`,
which is used for generics: `Generic[...]`, `list[...]`, etc.

What _is_ gramatically valid in such contexts? Seemingly any of the following.
(At least, none of the following throw `SyntaxError` in a 3.12.3 REPL.)

    Generic[x]
    Generic[*x]
    Generic[*x, y]
    Generic[y, *x]
    Generic[x := 1]
    Generic[x := 1, y := 2]

So introducting

    flexible_expression: expression | assignment_expression | starred_item

end then switching `subscription` to use `flexible_expression` sorts that.

But then we need to field `yield` - for which any of the following are
apparently valid:

    yield x
    yield x,
    yield x, y
    yield *x,
    yield *x, *y

Introducing a separate `yield_list` is the simplest way I've been figure out to
do this - separating out the special case of `starred_item ,`.

(cherry picked from commit 7d3497f617)

Co-authored-by: Matthew Rahtz <matthew.rahtz@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-09-26 13:03:28 -07:00
..
compound_stmts.rst [3.12] gh-115528: Update language reference for PEP 646 (GH-121181) (#124633) 2024-09-26 13:03:28 -07:00
datamodel.rst [3.12] gh-101100: Make __subclasses__ doctest stable (GH-124577) (#124580) 2024-09-26 06:40:40 +00:00
executionmodel.rst [3.12] gh-101100: Add a table of class attributes to the "Custom classes" section of the data model docs (#124480) (#124558) 2024-09-25 23:01:19 +00:00
expressions.rst [3.12] gh-115528: Update language reference for PEP 646 (GH-121181) (#124633) 2024-09-26 13:03:28 -07:00
grammar.rst [3.12] Docs: Add label to grammar spec for linking from PEPs (GH-113235) (#113239) 2023-12-17 19:30:10 +00:00
import.rst [3.12] gh-123517: Remove unnecessary :meth: parentheses (gh-123518) (GH-123576) 2024-09-02 16:02:39 +02:00
index.rst
introduction.rst [3.12] GH-103484: Fix permanently redirects reported by linkcheck (GH-124144) (GH-124152) 2024-09-16 20:53:46 -07:00
lexical_analysis.rst [3.12] gh-123579: Document exclamation token (GH-123612) (#123638) 2024-09-03 14:56:19 +00:00
simple_stmts.rst [3.12] gh-121355: Fix incorrect word in simple_stmts.rst (GH-121356) (#121363) 2024-07-04 13:43:31 +00:00
toplevel_components.rst GH-97950: Use new-style index directive ('builtin') (#104164) 2023-05-06 06:54:08 +03:00