Skip to content

Files

Latest commit

 

History

History
20 lines (13 loc) · 366 Bytes

named-expr-without-context.md

File metadata and controls

20 lines (13 loc) · 366 Bytes

Pattern: Use of named expression without context

Issue: -

Description

Emitted if named expression is used to do a regular assignment outside a context like if, for, while, or a comprehension.

Example of incorrect code:

(a := 42)  # [named-expr-without-context]

Example of correct code:

if (a := 42):
    print('Success')