How to make a copy of the list?
<p>I have a function:</p>

<pre><code>def mutate(self, index):
    ing1, ing2 = random.randrange(8), random.randrange(8)
    while ing1 == ing2:
        ing2 = random.randrange(8)
    ptr = self.drinkList[index].ing[:]
    ing1thr = ptr[ing1].max - ptr[ing1].perc
    ing2thr = ptr[ing2].perc - ptr[ing2].min
    mutatedFitness = 0
    if ing1thr &amp; ing2thr:
        change = random.randrange(ing1thr if ing1thr &lt; ing2thr else ing2thr)
        ptr[ing1].perc += change
        ptr[ing2].perc -= change
    for x in ptr:
        mutatedFitness += x.perc * x.price
    mutatedFitness = 280000 - mutatedFitness
    if mutatedFitness &gt; self.drinkList[index].fitness:
        self.drinkList[index].ing = ptr[:]
</code></pre>

<p>Now, I want the ptr to be a copy of self.drinkList[index].ing list, but in the debugger I noticed it points to the object itself instead of making a copy. I thought slicing was the way to avoid it, where did I make the mistake?</p>
