__getitem__ - :
>>> x = Ovl()
>>> x[6]
'Hi'
>>> x[8]
'Hi'
for, __iter__ (. : __iter __ (self) (Python)).
, , , __iter__, -, __getitem__ . , __getitem__(0), __getitem__(1), __getitem__(2), ... , .
__getitem__:
def __getitem__(self, index):
return index, "Hi"
, :
>>> x = Ovl()
>>> for item in x:
print item
(0, 'Hi')
(1, 'Hi')
(2, 'Hi')
(3, 'Hi')
(4, 'Hi')
(5, 'Hi')
(6, 'Hi')
...