Re: a=b change b a==b true??

2007-02-26 Thread Gabriel Genellina
En Mon, 26 Feb 2007 11:26:43 -0300, <[EMAIL PROTECTED]> escribió: > It works great now. Thank you for all of your incredibly quick > replies. Now that you have solved your immediate problem, you could read: http://effbot.org/zone/python-objects.htm -- Gabriel Genellina -- http://mail.python.

RE: a=b change b a==b true??

2007-02-26 Thread Delaney, Timothy (Tim)
[EMAIL PROTECTED] wrote: > All, > It works great now. Thank you for all of your incredibly quick > replies. > Rob You should have a read of these: http://wiki.python.org/moin/BeginnersGuide http://effbot.org/zone/python-objects.htm Cheers, Tim Delaney -- http://mail.python.org/mailman/listin

Re: a=b change b a==b true??

2007-02-26 Thread rstupplebeen
All, It works great now. Thank you for all of your incredibly quick replies. Rob -- http://mail.python.org/mailman/listinfo/python-list

Re: a=b change b a==b true??

2007-02-26 Thread bayer . justin
If you want to copy lists, you do it by using the [:] operator. e.g.: >>> a = [1,2] >>> b = a[:] >>> a [1, 2] >>> b [1, 2] >>> b[0] = 2 >>> a [1, 2] >>> b [2, 2] If you want to copy a list of lists, you can use a list comprehension if you do not want to use the copy module: >>> a = [[1,2],[3,4]]

Re: a=b change b a==b true??

2007-02-26 Thread Philipp Pagel
[EMAIL PROTECTED] wrote: > I do not have a clue what is happening in the code below. > >>> a=[[2,4],[9,3]] > >>> b=a > >>> [map(list.sort,b)] > [[None, None]] > >>> b > [[2, 4], [3, 9]] > >>> a > [[2, 4], [3, 9]] > I want to make a copy of matrix a and then make changes to the > matrices separate

Re: a=b change b a==b true??

2007-02-26 Thread Chris Mellon
On 26 Feb 2007 05:50:24 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I do not have a clue what is happening in the code below. > > >>> a=[[2,4],[9,3]] > >>> b=a > >>> [map(list.sort,b)] > [[None, None]] > >>> b > [[2, 4], [3, 9]] > >>> a > [[2, 4], [3, 9]] > > I want to make a copy of matr

Re: a=b change b a==b true??

2007-02-26 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > I do not have a clue what is happening in the code below. > a=[[2,4],[9,3]] b=a [map(list.sort,b)] > [[None, None]] b > [[2, 4], [3, 9]] a > [[2, 4], [3, 9]] > > I want to make a copy of matrix a and then make changes to the > matrices separate