.. _magic-value-comparison: magic-value-comparison / R2004 ============================== **Message emitted:** ``Consider using a named constant or an enum instead of '%s'.`` **Description:** *Using named constants instead of magic values helps improve readability and maintainability of your code, try to avoid them in comparisons.* **Problematic code:** .. literalinclude:: /data/messages/m/magic-value-comparison/bad.py :language: python **Correct code:** .. literalinclude:: /data/messages/m/magic-value-comparison/good.py :language: python **Configuration file:** .. literalinclude:: /data/messages/m/magic-value-comparison/pylintrc :language: ini .. note:: This message is emitted by the optional :ref:`'magic-value'` checker, which requires the ``pylint.extensions.magic_value`` plugin to be loaded. Created by the `magic-value `__ checker.