I need a list with the following behavior
>>> l = SparseList()
>>> l
[]
>>> l[2] = \"hello\"
>>> l
[ None, None, \"hello\
Dictionaries can be used as sparse lists. Whilst they will not provide the characteristics you are after (as you are not actually after a sparse list, all the list elements are complete references to None in a dynamically-sized Array), they act as a textbook sparse array.
sparse_vars = [(0,"Hi"),(10000,"Bye"),(20000,"Try")]
sparse_list = {}
for var in sparse_vars:
sparse_list[var[0]] = var[1]
>>> print sparse_list
{0: 'Hi', 10000: 'Bye', 20000: 'Try'}
>>> print sparse_list[20000]
'Try'