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

Total
0
Shares

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


Solution

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.

Source: StackOverflow.com

Leave a Reply

Your email address will not be published. Required fields are marked *