.. _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:**

.. literalinclude:: /data/messages/c/consider-using-any-or-all/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/c/consider-using-any-or-all/good.py
   :language: python




.. note::
  This message is emitted by the optional :ref:`'consider-using-any-or-all'<pylint.extensions.for_any_all>`
   checker which requires the ``pylint.extensions.for_any_all`` plugin to be loaded.

Created by the `consider-using-any-or-all <https://github.com/PyCQA/pylint/blob/main/pylint/extensions/for_any_all.py>`__ checker.