.. _simplifiable-if-expression:

simplifiable-if-expression / R1719
==================================

**Message emitted:**

The if expression can be replaced with %s

**Description:**

*Used when an if expression can be replaced with 'bool(test)' or simply 'test' if the boolean cast is implicit.*

**Problematic code:**

.. literalinclude:: /data/messages/s/simplifiable-if-expression/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/s/simplifiable-if-expression/good.py
   :language: python


**Related links:**

- `Simplifying an 'if' statement with bool() <https://stackoverflow.com/questions/49546992/>`_

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