.. _consider-using-assignment-expr:

consider-using-assignment-expr / R6103
======================================

**Message emitted:**

Use '%s' instead

**Description:**

*Emitted when an if assignment is directly followed by an if statement and both can be combined by using an assignment expression ``:=``. Requires Python 3.8 and ``py-version >= 3.8``.*

**Problematic code:**

.. literalinclude:: /data/messages/c/consider-using-assignment-expr/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/c/consider-using-assignment-expr/good.py
   :language: python




.. note::
  This message is emitted by the optional :ref:`'code_style'<pylint.extensions.code_style>`
   checker which requires the ``pylint.extensions.code_style`` plugin to be loaded.

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