Currently, I have some code like this
import numpy as np
ret = np.array([])
for i in range(100000):
tmp = get_input(i)
ret = np.append(ret, np.zeros(len
The usual way to handle this is something like this:
import numpy as np
ret = []
for i in range(100000):
tmp = get_input(i)
ret.append(np.zeros(len(tmp)))
ret.append(np.zeros(fixed_length))
ret = np.concatenate(ret)
For reasons that other answers have gotten into, it is in general impossible to extend an array without copying the data.