mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
bpo-35877: Make parenthesis optional for named expression in while statement (GH-11724)
* Add parenthesis optional in named expressions for while statement * Add NEWS entry
This commit is contained in:
parent
85d83ec7c9
commit
d4fceaafb8
4 changed files with 5 additions and 2 deletions
|
@ -426,6 +426,7 @@ class RoundtripLegalSyntaxTestCase(unittest.TestCase):
|
|||
self.check_suite("(a := 1)")
|
||||
self.check_suite("(a := a)")
|
||||
self.check_suite("if (match := pattern.search(data)) is None: pass")
|
||||
self.check_suite("while match := pattern.search(f.read()): pass")
|
||||
self.check_suite("[y := f(x), y**2, y**3]")
|
||||
self.check_suite("filtered_data = [y for x in data if (y := f(x)) is None]")
|
||||
self.check_suite("(y := f(x))")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue