I'll appreciate an explanation to the different results. I've written a simple code to pinpoint my question:
import numpy as np
def mulby2_v1(x):
    x = x * 2
    return(x)
def mulby2_v2(x):
    for idx in range(len(x)):
        x[idx] = x[idx] * 2
    return(x)
vecin = np.ones(10,)
vecout = mulby2_v1(vecin)
print('v1:\n',np.vstack([vecin, vecout]))
print('--------------------')
vecin = np.ones(10,)
vecout = mulby2_v2(vecin)
print('v2:\n',np.vstack([vecin, vecout]))
Which result with
v1:
 [[ 1.  1.  1.  1.  1.  1.  1.  1.  1.  1.]
 [ 2.  2.  2.  2.  2.  2.  2.  2.  2.  2.]]
--------------------
v2:
 [[ 2.  2.  2.  2.  2.  2.  2.  2.  2.  2.]
 [ 2.  2.  2.  2.  2.  2.  2.  2.  2.  2.]]
The input vector itself is modified in v2 but not in v1. Now why resetting a variable by index change the input while multiplying the whole vecotr by a scalar does not?
