Python original list still being modified after being copied : <pre><code>    def get_all_children(self):
    zero = self.current_coords[0]
    zero_row, zero_col = zero
    states = []
    # blank spot is not on top row(middle or bottom) so we move up!
    if zero_row &gt; 0:
        swapRow = zero_row - 1
        tempState = copy.copy(self.current) # a list of list of strings
        tempState[zero_row][zero_col], tempState[swapRow][zero_col] = tempState[swapRow][zero_col], tempState[zero_row][zero_col]
        s = State(tempState)
        states.append(s)
    ##  blank spot is not on the bottom row(middle or top) so we move down!
    if zero_row &lt; 2:
        swapRow = zero_row + 1
        tempState = copy.copy(self.current)
        tempState[zero_row][zero_col], tempState[swapRow][zero_col] = tempState[swapRow][zero_col], tempState[zero_row][zero_col]
        s = State(tempState)
        states.append(s)
</code></pre>

<p>I have a State class that contains a list of lists named 'current' and i'm trying to define a function that gets all the possible children(moves) of the current state. in the first IF statement, i create a COPY of the current variable(which is a list of lists) and store it in a 'tempState' list and then i try to swap values on that tempState, create a State object passing that in and then append that object to a list. All that works fine. The problem is when it get's to the 2nd IF statement. After i did the swap, It modified the original 'current' variable even though i created a copy! and I can't figure out why.
I tried list(self.current), self.current[:], copy.cop(self.current). Please help</p>
