maurice.char...@telecom-paristech.fr wrote:

> from numpy import random
> x=random.randn(6)
> y=x
> y[0]=12
> print x[0]
> 
> 
> 

random.rand returns a list. x is a label to this list (container).
y=x creates another label to the same container/list.

y[0[ = 12 alters the 0th position of the container.
print x[0], uses a different label 'x' to change the same container.

use: y = list(x) to do a 'shallow copy' of x into a new list container
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to