.. _invalid-index-returned:

invalid-index-returned / E0305
==============================

**Message emitted:**

__index__ does not return int

**Description:**

*Used when an __index__ method returns something which is not an integer*


**Correct code:**

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

**Additional details:**

You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ !


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