]> git.madduck.net Git - etc/vim.git/blob - tests/data/pep_572.py

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Reset trailing comma handling
[etc/vim.git] / tests / data / pep_572.py
1 (a := 1)
2 (a := a)
3 if (match := pattern.search(data)) is None:
4     pass
5 [y := f(x), y ** 2, y ** 3]
6 filtered_data = [y for x in data if (y := f(x)) is None]
7 (y := f(x))
8 y0 = (y1 := f(x))
9 foo(x=(y := f(x)))
10
11
12 def foo(answer=(p := 42)):
13     pass
14
15
16 def foo(answer: (p := 42) = 5):
17     pass
18
19
20 lambda: (x := 1)
21 (x := lambda: 1)
22 (x := lambda: (y := 1))
23 lambda line: (m := re.match(pattern, line)) and m.group(1)
24 x = (y := 0)
25 (z := (y := (x := 0)))
26 (info := (name, phone, *rest))
27 (x := 1, 2)
28 (total := total + tax)
29 len(lines := f.readlines())
30 foo(x := 3, cat="vector")
31 foo(cat=(category := "vector"))
32 if any(len(longline := l) >= 100 for l in lines):
33     print(longline)
34 if env_base := os.environ.get("PYTHONUSERBASE", None):
35     return env_base
36 if self._is_special and (ans := self._check_nans(context=context)):
37     return ans
38 foo(b := 2, a=1)
39 foo((b := 2), a=1)
40 foo(c=(b := 2), a=1)
41
42 while x := f(x):
43     pass