Re: [Tutor] could someone explain why this happens to me.

2009-03-08 Thread Lie Ryan
Sander Sweers wrote: 2009/3/7 Alan Gauld : mycopy = original[:] Returns a slice of the original list. In this case it so happens the slice is the full list. mycopy = list(original) Use the list type constructor to make a list out of its argument. It just so happens the argument in this case

Re: [Tutor] could someone explain why this happens to me.

2009-03-07 Thread Sander Sweers
2009/3/7 Alan Gauld : >> mycopy = original[:] > > Returns a slice of the original list. In this case it so happens > the slice is the full list. > >> mycopy = list(original) > > Use the list type constructor to make a list out of its argument. > It just so happens the argument in this case is a lis

Re: [Tutor] could someone explain why this happens to me.

2009-03-07 Thread عماد نوفل
2009/3/7 Alan Gauld > > "Emad Nawfal (عماد نوفل)" wrote > > As a linguist, I would love to know what the difference between these >> things are: >> > > The differences are the same whether you are a linguist or not :-) > (and yes I know my reading is incorrect grammaticallly but I couldn't > re

Re: [Tutor] could someone explain why this happens to me.

2009-03-07 Thread Alan Gauld
"Emad Nawfal (عماد نوفل)" wrote As a linguist, I would love to know what the difference between these things are: The differences are the same whether you are a linguist or not :-) (and yes I know my reading is incorrect grammaticallly but I couldn't resist it!) mycopy = original[:] Re

Re: [Tutor] could someone explain why this happens to me.

2009-03-07 Thread عماد نوفل
On Sat, Mar 7, 2009 at 2:36 PM, Kapsicum wrote: > > > On Sun, Mar 8, 2009 at 12:39 AM, sphennings W. wrote: > >> When I enter the following code into IDLE do both lists have the same >> value? >> How would I manipulate both lists separately? >> >> >>> List1=[1,2,3] >> >>> List2=List1 >> >>> List

Re: [Tutor] could someone explain why this happens to me.

2009-03-07 Thread Kapsicum
On Sun, Mar 8, 2009 at 12:39 AM, sphennings W. wrote: > When I enter the following code into IDLE do both lists have the same > value? > How would I manipulate both lists separately? > > >>> List1=[1,2,3] > >>> List2=List1 > >>> List2.reverse() > >>> print(List2) > [3, 2, 1] > >>> print(List1) >

Re: [Tutor] could someone explain why this happens to me.

2009-03-07 Thread Emile van Sebille
sphennings W. wrote: When I enter the following code into IDLE do both lists have the same value? They way you've done it, both names List1 and List2 refer/point to the same list. Changes to one affect both. How would I manipulate both lists separately? Assign them separately or use a c

Re: [Tutor] could someone explain why this happens to me.

2009-03-07 Thread عماد نوفل
On Sat, Mar 7, 2009 at 2:09 PM, sphennings W. wrote: > When I enter the following code into IDLE do both lists have the same > value? > How would I manipulate both lists separately? > > >>> List1=[1,2,3] > >>> List2=List1 > >>> List2.reverse() > >>> print(List2) > [3, 2, 1] > >>> print(List1) >

[Tutor] could someone explain why this happens to me.

2009-03-07 Thread sphennings W.
When I enter the following code into IDLE do both lists have the same value? How would I manipulate both lists separately? >>> List1=[1,2,3] >>> List2=List1 >>> List2.reverse() >>> print(List2) [3, 2, 1] >>> print(List1) [3, 2, 1] >>> List2.append(0) >>> print(List2) [3, 2, 1, 0] >>> print(List1)