-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-35224: PEP 572 Implementation #10497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
11e9898
9e9156c
6eb766d
4f42586
e049ffa
0b6bd95
24e95fd
d31135f
e19a900
aca4858
2c7b01e
f0dad89
fbea15f
3cd271b
7b34033
13671f7
5e4ba89
c1c76ea
0ebccb4
5500849
38dfaa2
3aaddc4
5d525a9
32dc443
d806088
c1469bf
e4e63ed
db936c7
47e7367
787068e
e21f5c8
acd0f74
d0dd983
9b136d9
8fc5c99
538dea4
ab34b0b
c04a08d
f0297f8
ee6d789
c37e3c1
1db3fa9
0e29038
2ff5744
2494008
794a1d1
415d469
162c8c4
68e9e98
1ad4b30
1b1d84d
b80108b
6e15f5f
da11136
051ad8c
f893035
16d7137
070983b
5133800
bc2fed3
f1cabf8
0e0ca07
1153aae
7775b0d
10a71f8
2b9a7bc
a63bf06
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,7 +69,7 @@ assert_stmt: 'assert' test [',' test] | |
|
||
compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef | decorated | async_stmt | ||
async_stmt: 'async' (funcdef | with_stmt | for_stmt) | ||
if_stmt: 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite] | ||
if_stmt: 'if' namedexpr_test ':' suite ('elif' namedexpr_test ':' suite)* ['else' ':' suite] | ||
while_stmt: 'while' test ':' suite ['else' ':' suite] | ||
for_stmt: 'for' exprlist 'in' testlist ':' suite ['else' ':' suite] | ||
try_stmt: ('try' ':' suite | ||
|
@@ -83,6 +83,7 @@ with_item: test ['as' expr] | |
except_clause: 'except' [test ['as' NAME]] | ||
suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT | ||
|
||
namedexpr_test: test [':=' test] | ||
test: or_test ['if' or_test 'else' test] | lambdef | ||
test_nocond: or_test | lambdef_nocond | ||
lambdef: 'lambda' [varargslist] ':' test | ||
|
@@ -108,7 +109,7 @@ atom: ('(' [yield_expr|testlist_comp] ')' | | |
'[' [testlist_comp] ']' | | ||
'{' [dictorsetmaker] '}' | | ||
NAME | NUMBER | STRING+ | '...' | 'None' | 'True' | 'False') | ||
testlist_comp: (test|star_expr) ( comp_for | (',' (test|star_expr))* [','] ) | ||
testlist_comp: (namedexpr_test|star_expr) ( comp_for | (',' (namedexpr_test|star_expr))* [','] ) | ||
trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME | ||
subscriptlist: subscript (',' subscript)* [','] | ||
subscript: test | [test] ':' [test] [sliceop] | ||
|
@@ -134,6 +135,7 @@ arglist: argument (',' argument)* [','] | |
# multiple (test comp_for) arguments are blocked; keyword unpackings | ||
# that precede iterable unpackings are blocked; etc. | ||
argument: ( test [comp_for] | | ||
test ':=' test | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like a bug magnet: |
||
test '=' test | | ||
'**' test | | ||
'*' test ) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,7 @@ AT '@' | |
ATEQUAL '@=' | ||
RARROW '->' | ||
ELLIPSIS '...' | ||
COLONEQUAL ':=' | ||
|
||
OP | ||
ERRORTOKEN | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not
[x := 1, 2]
look too ambiguous? Why this syntax is allowed?{x := 1, 2}
,{x := 1 : 2}
and{1 : x := 2}
are not allowed.