You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
lambda grammar in the language reference incorrectly allows annotations #156675
The language reference defines lambda_expr: "lambda" [parameter_list] ":" expression, reusing parameter_list from the function definition. The grammar explicitly avoids this because:
# lambda_parameters etc. duplicates parameters but without annotations
# or type comments, and if there's no comma after a parameter, we expect
# a colon, not a close parenthesis. (For more, see parameters above.)
So, it uses parameter: identifier [":" expression] which is incorrect since lambda parameters can't be annotated. A separate lambda_parameter_list family of productions is probably needed, although it's not ideal as it would largely be duplicated. @encukou, what do you think?
Yeah, there's a bunch of similar issues with the hand-written grammar in the docs. Lambdas are section 6.14; I'm currently working on 6.2.8 :)
(Thank you for the review on #154884 btw!)
Activity
encukou commentedon Sep 2, 2026
Yeah, there's a bunch of similar issues with the hand-written grammar in the docs. Lambdas are section 6.14; I'm currently working on 6.2.8 :)
(Thank you for the review on #154884 btw!)