__getitem__() in Python - GeeksforGeeks
www.geeksforgeeks.org › __getitem__-in-pythonMar 26, 2020 · Internally it is called as: __getitem__ () is a magic method in Python, which when used in a class, allows its instances to use the [] (indexer) operators. Say x is an instance of this class, then x [i] is roughly equivalent to type (x).__getitem__ (x, i). The method __getitem__ (self, key) defines behavior for when an item is accessed, using ...