class DynamicList(list):

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

def __getitem__(self, index):
    while index >= len(self):
        self.append(next(self.gen))
return super(DynamicList, self).__getitem__(index)

def __getslice__(self, start, stop):
    if stop == 2147483647:
        stop = len(self)
while stop > len(self):
    self.append(next(self.gen))
return super(DynamicList, self).__getslice__(start, stop)

def __iter__(self):
    return self

def next(self):
    n = next(self.gen)
self.append(n)
return n
a = DynamicList(iter(range(10)))
Динамический список, который автоматически расширяется