title: Python function argument scope (Dictionaries v. Strings)
body: <p>foo = "foo"
      def bar(foo):
          foo = "bar"</p>
  
  <pre><code>bar(foo)
  print foo
  
  # foo is still "foo"...
  
  foo = {'foo':"foo"}
  def bar(foo): 
      foo['foo'] = "bar"
  
  bar(foo)
  print foo['foo']
  
  # foo['foo'] is now "bar"?
  </code></pre>
  
  <p>I have a function that has been inadvertently over-writing my function parameters when I pass a dictionary. Is there a clean way to declare my parameters as constant or am I stuck making a copy of the dictionary within the function?</p>
  
  <p>Thanks! </p>