Debian Codegraph @

tests/data/cases/pep_572_py310.py

raw
1 # flags: --minimum-version=3.10
2 # Unparenthesized walruses are now allowed in indices since Python 3.10.
3 x[a := 0]
4 x[a := 0, b := 1]
5 x[5, b := 0]
6
7 # Walruses are allowed inside generator expressions on function calls since 3.10.
8 if any(match := pattern_error.match(s) for s in buffer):
9 if match.group(2) == data_not_available:
10 # Error OK to ignore.
11 pass
12
13 f(a := b + c for c in range(10))
14 f((a := b + c for c in range(10)), x)
15 f(y=(a := b + c for c in range(10)))
16 f(x, (a := b + c for c in range(10)), y=z, **q)
17
18
19 # Don't remove parens when assignment expr is one of the exprs in a with statement
20 with x, (a := b):
21 pass