.. _confusing-consecutive-elif: confusing-consecutive-elif / R5601 ================================== **Message emitted:** ``Consecutive elif with differing indentation level, consider creating a function to separate the inner elif`` **Description:** *Used when an elif statement follows right after an indented block which itself ends with if or elif. It may not be obvious if the elif statement was willingly or mistakenly unindented. Extracting the indented if statement into a separate function might avoid confusion and prevent errors.* **Problematic code:** .. literalinclude:: /data/messages/c/confusing-consecutive-elif/bad.py :language: python **Correct code:** .. literalinclude:: /data/messages/c/confusing-consecutive-elif/good.py :language: python **Configuration file:** .. literalinclude:: /data/messages/c/confusing-consecutive-elif/pylintrc :language: ini **Additional details:** Creating a function for the nested conditional, or adding an explicit ``else`` in the indented ``if`` statement, even if it only contains a ``pass`` statement, can help clarify the code. .. note:: This message is emitted by the optional :ref:`'confusing_elif'` checker, which requires the ``pylint.extensions.confusing_elif`` plugin to be loaded. Created by the `confusing_elif `__ checker.