title: Loading serialised object from YAML and replacing current object with it
body: <p>I have what I would have thought would be a fairly common problem, but I can't seem to find out how to do what I want.</p>
  
  <p>I have a class in Python that has a number of instance variables which contain parameters for a model. I have added two methods to the class:</p>
  
  <pre><code>def save_params(self, filename):
      f = open(filename, "w")
      yaml.dump(self, f, default_flow_style=False)
      f.close()
  
  def load_params(self, filename):
      f = open(filename, "r")
      obj = yaml.load(f)
      print obj.aero_soot
      self = copy.deepcopy(obj)
      f.close()
  </code></pre>
  
  <p>I want to use these to save the values of the attributes of this object to a YAML file, and then load them back from a YAML file.</p>
  
  <p><code>save_params</code> works fine, but <code>load_params</code> doesn't. It loads from the YAML file fine into <code>obj</code>, but the attributes in obj don't get set properly in the current instance of the object (<code>self</code>).</p>
  
  <p>I'm probably doing something stupid here, but what is it?</p>