This rule is unstable and in preview. The
--preview flag is required for use.
What it does#
Checks for named assignment expressions (e.g.,
x := 0) in
Why is this bad?#
Named assignment expressions (also known as "walrus operators") are used to assign a value to a variable as part of a larger expression.
Named assignments are syntactically valid in
assert statements. However,
when the Python interpreter is run under the
are not executed. In this case, the named assignment will also be ignored,
which may result in unexpected behavior (e.g., undefined variable