title: Python copy.deepcopy() function not working properly
body: <p>I have been playing with the deepcopy function and the copy function and I get the same issue with both of them. It is like the copy was a reference (or a pointer) instead of a proper copy. I am working with data records (classes) in Python, maybe it could be that.. I show you an example:</p>
  
  <pre><code>&gt;&gt;&gt; import copy
  &gt;&gt;&gt; class player1:
  ...    age = 23
  ...    score = 1
  &gt;&gt;&gt; class player2:
  ...    age = 14
  ...    score = 2
  &gt;&gt;&gt; player3 = copy.deepcopy(player1)
  </code></pre>
  
  <p>I print the parameters.</p>
  
  <pre><code>&gt;&gt;&gt; print player1.age, player1.score
  23 1
  &gt;&gt;&gt; print player2.age, player2.score
  14 2
  &gt;&gt;&gt; print player3.age, player3.score
  23 1
  </code></pre>
  
  <p>Now I increment the score parameter in player1 data record.</p>
  
  <pre><code>&gt;&gt;&gt; player1.score += 3
  </code></pre>
  
  <p>And I print the results again.</p>
  
  <pre><code>&gt;&gt;&gt; print player1.age, player1.score
  23 4
  &gt;&gt;&gt; print player2.age, player2.score
  14 2
  &gt;&gt;&gt; print player3.age, player3.score
  23 4 
  </code></pre>
  
  <p>WHY HAS PLAYER 3 CHANGED?
  I just incremented a parameter in player1, not player3. It is mutable instead of immutable.</p>
  
  <p>Thanks in advance.</p>