I was unable to find anything describing how to do this, which leads to be believe I\'m not doing this in the proper idiomatic Python way. Advice on the \'proper\' Python w
If you put your data in a collections.defaultdict
you won't need to do any explicit initialization. Everything will be initialized the first time it is used.
import numpy as np
import collections
n = 100
data = collections.defaultdict(lambda: np.zeros(n))
for i in range(1, n):
data['g'][i] = data['d'][i - 1]
# ...