.. _named-expr-without-context:

named-expr-without-context / W0131
==================================

**Message emitted:**

Named expression used without context

**Description:**

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

**Problematic code:**

.. literalinclude:: /data/messages/n/named-expr-without-context/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/n/named-expr-without-context/good.py
   :language: python



Created by the `basic <https://github.com/PyCQA/pylint/blob/main/pylint/checkers/base/basic_checker.py>`__ checker.