title: If slicing does not create a copy of a list nor does list() how can I get a real copy of my list?
body: <p>I am trying to modify a list and since my modifications were getting a bit tricky and my list large I took a slice of my list using the following code</p>
  
  <pre><code>tempList=origList[0:10]
  for item in tempList:
      item[-1].insert(0 , item[1])
      del item[1]
  </code></pre>
  
  <p>I did this thinking that all of the modifications to the list would affect tempList object and not origList objects.</p>
  
  <p>Well once I got my code right and ran it on my original list the first ten items (indexed 0-9) were affected by my manipulation in testing the code printed above.  </p>
  
  <p>So I googled it and I find references that say taking a slice copies the list and creates a new-one.  I also found code that helped me find the id of the items so I created my origList from scratch, got the ids of the first ten items.  I sliced the list again and found that the ids from the slices matched the ids from the first ten items of the origList.</p>
  
  <p>I found more notes that suggested a more pythonic way to copy a list would be to use</p>
  
  <pre><code>tempList=list(origList([0:10])
  </code></pre>
  
  <p>I tried that and I still find that the ids from the tempList match the ids from the origList.</p>
  
  <p>Please don't suggest better ways to do the coding-I am going to figure out how to do this in a list Comprehension on my own after I understand what how copying works</p>
  
  <p>Based on Kai's answer the correct method is:</p>
  
  <pre><code>import copy
  tempList=copy.deepcopy(origList[0:10])
  id(origList[0])
  &gt;&gt;&gt;&gt;42980096
  id(tempList[0])
  &gt;&gt;&gt;&gt;42714136
  </code></pre>
  
  <p>Works like a charm</p>