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.

Correct code:

LETTERS = ["a", "b", "c", "d"]

FIRST_THREE = LETTERS[:3]

Problematic code:

LETTERS = ["a", "b", "c", "d"]

FIRST_THREE = LETTERS[:"3"]  # [invalid-slice-index]

Created by the typecheck checker.