Newbie, problem array

Roland Oviol roviol at venmex.com
Wed Apr 11 10:48:39 EDT 2001


hello,

It's the problem

>>>d1=[[0,0]]
>>>d2=d1   #reference no copy
>>>d2[0][0]=3
>>>d2
[[3,0]]
>>>d1
[[3,0]]

ok

but,
>>>d1=[[0,0]]
>>>d2=d1[:]    #copy, no reference
>>>d2[0][0]=3
>>>d2
[[3,0]]
>>>d1
[[3,0]]

Why, is copy, no reference

How copy a object?


Excluse me, my english

Gracias (Thank's),
Saludos,
Roland




More information about the Python-list mailing list