.. _self-assigning-variable:

self-assigning-variable / W0127
===============================

**Message emitted:**

``Assigning the same variable %r to itself``

**Description:**

*Emitted when we detect that a variable is assigned to itself*

**Problematic code:**

.. literalinclude:: /data/messages/s/self-assigning-variable/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/s/self-assigning-variable/good.py
   :language: python



**Related links:**

- `Python assignment statement <https://docs.python.org/3/reference/simple_stmts.html#assignment-statements>`_


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