class myclass:
def __init__(self):
self.value = 0
def incr(self):
self.value += 1
return self.value
a = [5, 5]
i = myclass()
print 'i:', i.value
a[i.value] = i.incr()
print a
Y2xhc3MgbXljbGFzczoKICAgIGRlZiBfX2luaXRfXyhzZWxmKToKICAgICAgICBzZWxmLnZhbHVlID0gMAogICAgCiAgICBkZWYgaW5jcihzZWxmKToKICAgICAgICBzZWxmLnZhbHVlICs9IDEKICAgICAgICByZXR1cm4gc2VsZi52YWx1ZQogICAgICAgIAphID0gWzUsIDVdCmkgPSBteWNsYXNzKCkKCnByaW50ICdpOicsIGkudmFsdWUKCmFbaS52YWx1ZV0gPSBpLmluY3IoKQoKcHJpbnQgYQ==