.. _possibly-unused-variable:

possibly-unused-variable / W0641
================================

**Message emitted:**

Possibly unused variable %r

**Description:**

*Used when a variable is defined but might not be used. The possibility comes from the fact that locals() might be used, which could consume or not the said variable*

**Problematic code:**

.. literalinclude:: /data/messages/p/possibly-unused-variable/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/p/possibly-unused-variable/good.py
   :language: python



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