summaryrefslogtreecommitdiffstats
path: root/Python/context.c
diff options
context:
space:
mode:
authorMatthew Rahtz <matthew.rahtz@gmail.com>2024-09-26 19:35:17 (GMT)
committerGitHub <noreply@github.com>2024-09-26 19:35:17 (GMT)
commit7d3497f617edf77cb6ead6f5e62bce98d77b9ab8 (patch)
tree455a1b2a427034f465d86fd711def8f50f5f2aa3 /Python/context.c
parent43979fad904bcc343f90cb526faa526c45fcbfa4 (diff)
downloadcpython-7d3497f617edf77cb6ead6f5e62bce98d77b9ab8.zip
cpython-7d3497f617edf77cb6ead6f5e62bce98d77b9ab8.tar.gz
cpython-7d3497f617edf77cb6ead6f5e62bce98d77b9ab8.tar.bz2
gh-115528: Update language reference for PEP 646 (#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 ,`. Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Diffstat (limited to 'Python/context.c')
0 files changed, 0 insertions, 0 deletions