.. _too-many-nested-blocks:

too-many-nested-blocks / R1702
==============================

**Message emitted:**

Too many nested blocks (%s/%s)

**Description:**

*Used when a function or a method has too many nested blocks. This makes the code less understandable and maintainable.*

**Problematic code:**

.. literalinclude:: /data/messages/t/too-many-nested-blocks/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/t/too-many-nested-blocks/good.py
   :language: python



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