Having a list like:

```
 >>> l = [0, 1, 1, 1, 0, 2, 2, 2, 0]

```

How could I implement a Proxy that computes the sum of the repeated numbers, and the indexing operation behaves like:

```
>>> proxy = Proxy(l) 
>>> proxy[0]
0
>>> proxy[1] 
3 
>>> proxy[2]  
0     
>>> proxy[3] 
6 
>>> proxy[4]  
0 

```

The underlying list must be invariant. The Proxy would be a class that receives the list and implements **getitem**, like:

```
class Proxy:

    def __init__(self, l):
        self.l = l 

    def __getitem__(self, index):
        pass 

```

I need some kind of "on the fly" computation in the **getitem** method. I need to keep the list absolutely invariant, in order to leverage some framework.