Problem:
- The function
freturns the numpy ndarraysnp_array_1, np_array_2. Both arrays have the same length, but this length may be different for each call. - I want to call
fseveral times and keep only the two arrays concatenated from the different calls.
Question: Is there a way to do it without using temporal variables? Using temporal variables:
def f(i):
...
return np_array_1, np_array_2
np_array_1, np_array_2 = f(0)
for i in range(1, 5):
np_array_1_t, np_array_2_t = f(i)
np_array_1 = np.concatenate(np_array_1, np_array_1_t)
np_array_2 = np.concatenate(np_array_2, np_array_2_t)
del np_array_1_t, np_array_2_t