title: PyYAML : Control ordering of items called by yaml.load()
body: <p>I have a yaml setting file which creates some records in db:</p>
  
  <pre><code>setting1:
    name: [item,item]
    name1: text
  anothersetting2:
    name: [item,item]
    sub_setting:
        name :[item,item]
  </code></pre>
  
  <p>when i update this file with <em>setting3</em> and regenerate records in db by:</p>
  
  <pre><code>import yaml
  fh = open('setting.txt', 'r')
  setting_list = yaml.load(fh)
  for i in setting_list:
      add_to_db[i]
  </code></pre>
  
  <p>it's vital that the order of them settings (id numbers in db) stay the same each time as im addig them to the db... and setting3 just gets appended to the yaml.load()'s end so that its id doesn't confuse any records which are already in the db ... 
  At the moment each time i add another setting and call yaml.load() records get loaded in different order which results in different ids. I would welcome any ideas ;)</p>
  
  <p><strong>EDIT:</strong>
  I've followed <em>abarnert</em> tips and took this gist <a href="https://gist.github.com/844388" rel="noreferrer">https://gist.github.com/844388</a></p>
  
  <p>Works as expected thanks ! </p>