What does unsubscriptable
mean in the context of a TypeError as in:
TypeError: \'int\' object is unsubscriptable
EDIT: Short c
You are trying to lookup an array subscript of an int:
>>> 1[0]
Traceback (most recent call last):
File "", line 1, in
TypeError: 'int' object is unsubscriptable
That is, square brackets []
are the subscript operator. If you try to apply the subscript operator to an object that does not support it (such as not implementing __getitem__()
).