title: Python pass by value
body: <p>I'm a beginner for Python. I want to know some cases to pass by values instead of references. Assume we have the class:</p>
  
  <pre><code>class myC():
      def __init__(self, x):
          self.val = x
  </code></pre>
  
  <p>and the functions:</p>
  
  <pre><code>def myF1(myc):
      myc.val = 1
  def myF2(myDict):
      myDict['a'] = 0
  </code></pre>
  
  <p>if we define the variable and call the function:</p>
  
  <pre><code>a = myC(0)
  myDict = {}
  myF1(a)
  myF2(myDict)
  </code></pre>
  
  <p>The value of the variable a and myDict will change since both user defined class and dictionary are mutable types. Is there ant method that just pass the value of the variable so that the variable itself won't change? If there are multiple ways, please let me know all of them. Thank you very much.</p>