class Foo:

    def __init__(self, data1, data2):
        self.data1 = data1
self.data2 = data2
self.key = 0

def getData(self):
    return Foo.Wrapper(self, self.data2)

def getKey(self):
    return self.key


class Wrapper:

    def __init__(self, outer, data):
        self.outer = outer
self.data = data

def __getitem__(self, key):
    self.outer.key = key
return self.data[key]
if __name__ == '__main__':
    data1 = [10, 20, 30, 40]
data2 = [100, 200, 300, 400]
foo = Foo(data1, data2)
wrapped_data2 = foo.getData()
print(wrapped_data2[2:4])
print(data1[foo.getKey()])
Python operating on multiple data arrays in a rolling window