title: Python - update a class self dictionary inside a class function
body: <p>I have a dictionary declare in a class (self.d1).
  After calling f1 function, self.d1 need to be update to a local dict declare inside f1</p>
  
  <pre><code>import copy
  
  class num:
      def __init__(self):
          self.d1 = {'a':1, 'b':2, 'c':3}
          self.f1(self.d1)
  
          print self.d1
  
      def f1(self,d):
          d2 = {'d':4, 'e':5, 'f':6}
          d = copy.deepcopy(d2)
  
  test = num()
  </code></pre>
  
  <p>I expect the output to be:</p>
  
  <pre><code>{'d':4, 'e':5, 'f':6}
  </code></pre>
  
  <p>but the output is </p>
  
  <pre><code>{'a':1, 'b':2, 'c':3}
  </code></pre>
  
  <p>I want to understand what the problem is and not only the solution</p>