Name
__getitem__
Synopsis
__getitem__(self,key
)
When
x
[
key
]
is accessed (i.e., when container x
is
indexed or sliced), Python calls
x
.__getitem__(
key
)
. All
containers should have __getitem__
.
Get Python in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.