.. _invalid-bool-returned:

invalid-bool-returned / E0304
=============================

**Message emitted:**

__bool__ does not return bool

**Description:**

*Used when a __bool__ method returns something which is not a bool*

**Problematic code:**

.. literalinclude:: /data/messages/i/invalid-bool-returned/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/i/invalid-bool-returned/good.py
   :language: python



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