x = y

Rainer Deyke root at rainerdeyke.com
Tue Feb 6 16:49:21 EST 2001


"Jay O'Connor" <joconnor at cybermesa.com> wrote in message
news:3a806eed.5209768 at news.cybermesa.com...
> On Tue, 06 Feb 2001 21:13:13 GMT, "José Luis Gallego"
> <gallegoj at ono.com> wrote:
>
> >Hi all,
> >
> >I want to create a list x from a list y:
> >
> >y = [[1,2,3],[4,5,6]]
> >x = y
> >
> >How do I change individual elements of x without changing y?
>
>
> Make a copy of the list
>
> x  = list (y)

I think he wants a deep copy.  The 'copy' module might be useful here.


--
Rainer Deyke (root at rainerdeyke.com)
Shareware computer games           -           http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor





More information about the Python-list mailing list