.. _too-many-locals:

too-many-locals / R0914
=======================

**Message emitted:**

``Too many local variables (%s/%s)``

**Description:**

*Used when a function or method has too many local variables.*

**Problematic code:**

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

**Correct code:**

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

**Configuration file:**

.. literalinclude:: /data/messages/t/too-many-locals/pylintrc
    :language: ini

**Additional details:**

Having too many locals may indicate that you're doing too much in a function and that
classes regrouping some attributes could be created. Maybe operations could be separated in
multiple functions. Are all your variables really closely related ?



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