Files
openide/python/testData/highlighting/invalidAssignmentExpressions.py
Tatiana Berandintellij-monorepo-bot 2bf9d316a5 PY-87796 UI Texts: Fix typos and grammar mistakes (Feb 2026)
(cherry picked from commit f4b52fc04911cc80b05fc155485fa5aafcd70bf4)

GitOrigin-RevId: 76b3859ef35485c1704d9d12419fae927a3989c6
2026-02-20 23:47:12 +00:00

8 lines
546 B
Python

<error descr="Unparenthesized assignment expressions are prohibited at the top level of an expression statement">y := f(x)</error> # INVALID
(y := f(x)) # Valid, though not recommended
y0 = <error descr="Unparenthesized assignment expressions are prohibited at the top level of the right-hand side of an assignment statement">y1 := f(x)</error> # INVALID
y0 = (y1 := f(x)) # Valid, though discouraged
class A:
[<error descr="Assignment expressions within a comprehension cannot be used in a class body">y := i</error> for i in range(2)]