]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-42381: Allow walrus in set literals and set comprehensions (GH-23332)
authorPablo Galindo <Pablogsal@gmail.com>
Tue, 17 Nov 2020 01:17:12 +0000 (01:17 +0000)
committerGitHub <noreply@github.com>
Tue, 17 Nov 2020 01:17:12 +0000 (01:17 +0000)
commitb0aba1fcdc3da952698d99aec2334faa79a8b68c
tree7a349807a405f2adf73bd64b766715d543c22b81
parenta57b3d30f66c90f42da751bf82256b9b22961ed0
bpo-42381: Allow walrus in set literals and set comprehensions (GH-23332)

Currently walruses are not allowerd in set literals and set comprehensions:

>>> {y := 4, 4**2, 3**3}
  File "<stdin>", line 1
    {y := 4, 4**2, 3**3}
       ^
SyntaxError: invalid syntax

but they should be allowed as well per PEP 572
Grammar/python.gram
Lib/test/test_named_expressions.py
Misc/NEWS.d/next/Core and Builtins/2020-11-16-23-45-56.bpo-42381.G4AWxL.rst [new file with mode: 0644]
Parser/parser.c