.. _invalid-slice-index:

invalid-slice-index / E1127
===========================

**Message emitted:**

Slice index is not an int, None, or instance with __index__

**Description:**

*Used when a slice index is not an integer, None, or an object with an __index__ method.*

**Problematic code:**

.. literalinclude:: /data/messages/i/invalid-slice-index/bad.py
   :language: python

**Correct code:**

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



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