[EMAIL PROTECTED] a écrit :
> I have run into a bit of a subtle problem.  How do I go about
> duplicating a variable (particularly a list of lists) in python.

using the deepcopy function of the copy module.

>  I
> was surprised when simple assignment didn't work. For example, let y =
> [1,2,3]
> 
>>>> x = y
>>>> x[2] = 5
>>>> y
> [1,2,5]

Python only uses object references. It never copy anything unless 
explicitely asked for.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to