Fix Python – What does it mean if a Python object is “subscriptable” or not?

Question

Asked By – Alistair

Which types of objects fall into the domain of “subscriptable”?

Now we will see solution for issue: What does it mean if a Python object is “subscriptable” or not?


Answer

It basically means that the object implements the __getitem__() method. In other words, it describes objects that are “containers”, meaning they contain other objects. This includes strings, lists, tuples, and dictionaries.

This question is answered By – mipadi

This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0