| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 149ed7f commit ff0d621
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1766,6 +1766,13 @@ Or, when processing a file stream in chunks: | |||
| 1766 | 1766 | while chunk := file.read(9000): | |
| 1767 | 1767 | process(chunk) | |
| 1768 | 1768 | ||
| 1769 | + Assignment expressions must be surrounded by parentheses when used | ||
| 1770 | + as sub-expressions in slicing, conditional, lambda, | ||
| 1771 | + keyword-argument, and comprehension-if expressions | ||
| 1772 | + and in ``assert`` and ``with`` statements. | ||
| 1773 | + In all other places where they can be used, parentheses are not required, | ||
| 1774 | + including in ``if`` and ``while`` statements. | ||
| 1775 | + | ||
| 1769 | 1776 | .. versionadded:: 3.8 | |
| 1770 | 1777 | See :pep:`572` for more details about assignment expressions. | |
| 1771 | 1778 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1 @@ | |||
| 1 | + Document some places where an assignment expression needs parentheses. | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments