title: Could someone help me here? Python object maintaining between separate functions
body: <p>I wrote this simple python program to help me with a bug in another program. It clearly illustrates the problem. </p>
  
  <pre><code>import copy
  
  class Obj(object):
      def __init__(self, name):
          self.name = name
  
  def one(o):
      print("1: o.name:", o.name) # "foo"
      obackup = copy.deepcopy(o) 
      o.name = "bar"
      print("2: o.name:", o.name) # "bar"
      print("3: obackup.name:", obackup.name) # "foo"
      o = obackup
      print("4: o.name:", o.name) # "foo"
  
  def two(o):
      print("5: o.name:", o.name) # "bar"!
  
  def main():
      o = Obj("foo")
      one(o)
      two(o)
  
  main()
  </code></pre>
  
  <p>My guess is that <code>o</code> is being overwritten somehow as a local variable to the function <code>one()</code>. But I have no idea how to fix that. </p>