E1136 unsubscriptable-object

Message

"Value '%s' is unsubscriptable"

Description

Emitted when a subscripted value doesn’t support subscription (i.e. doesn’t define __getitem__ method or __class_getitem__ for a class).

Example

In the following example, the integer value 1 does not support the subscript access var[0].

def example():
    var = 1
    return var[0]
3:11: E1136: Value 'var' is unsubscriptable

False positives

This check is suspectible to false positive results, because it relies on pylint’s inference system.

Running Pylint locally? In your CI?

There is a better way! Run PyCodeQual & get Pylint findings with history, diffs and statistics.

Click here to find out more.