.. _consider-using-any-or-all: consider-using-any-or-all / C0501 ================================= **Message emitted:** ```for` loop could be `%s``` **Description:** *A for loop that checks for a condition and return a bool can be replaced with any or all.* **Problematic code:** ``all_even.py``: .. literalinclude:: /data/messages/c/consider-using-any-or-all/bad/all_even.py :language: python ``any_even.py``: .. literalinclude:: /data/messages/c/consider-using-any-or-all/bad/any_even.py :language: python **Correct code:** ``all_even.py``: .. literalinclude:: /data/messages/c/consider-using-any-or-all/good/all_even.py :language: python ``any_even.py``: .. literalinclude:: /data/messages/c/consider-using-any-or-all/good/any_even.py :language: python **Configuration file:** .. literalinclude:: /data/messages/c/consider-using-any-or-all/pylintrc :language: ini .. note:: This message is emitted by the optional :ref:`'consider-using-any-or-all'` checker, which requires the ``pylint.extensions.for_any_all`` plugin to be loaded. Created by the `consider-using-any-or-all `__ checker.