.. _no-else-raise:

no-else-raise / R1720
=====================

**Message emitted:**

Unnecessary "%s" after "raise", %s

**Description:**

*Used in order to highlight an unnecessary block of code following an if containing a raise statement. As such, it will warn when it encounters an else following a chain of ifs, all of them containing a raise statement.*

**Problematic code:**

.. literalinclude:: /data/messages/n/no-else-raise/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/n/no-else-raise/good.py
   :language: python



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