class OOBList(list):

    def __init__(self, default, *args, **kwargs):
        super(OOBList, self).__init__(*args, **kwargs)
self.default = default

def __setitem__(self, index, value):
    max_index = len(self) - 1
if index > max_index:
    self.extend([self.default] * (index - max_index))
super(OOBList, self).__setitem__(index, value)
Out of bounds assignment to a python array - am I reinventing a wheel?