strange append
E.Nurminski
nurmi at dvo.ru
Mon Oct 2 00:49:05 EDT 2006
Hello to all good people
I am new to the great Py so am quite puzzled by the following code
---------------
res = []
x = [ 1, 1 ]
for i in xrange(0,5):
res.append(x)
x[1] = x[1] + 1
print "x = ", x
print "res = ", res
---------------
Looks like it puts smth like reference to 'x' into 'res' list, instead of
value. But if I want a value should I use a different method or what ?
Evgeni
P.S. Could not easily find the issue in the manual/tutorial can you point
me out to smth relevant ?
More information about the Python-list
mailing list