title: Order of insertion in sets (when parsing {})
body: <p>Someone asked <a href="https://stackoverflow.com/questions/46003779/python-3-1-dictionary-python-upper-case-values-present-in-a-single-key-2-wh">here</a> why when putting <code>1</code> and <code>True</code> in a <code>set</code> only <code>1</code> is kept.</p>
  
  <p>This is of course because <code>1==True</code>. But in which cases <code>1</code> is kept and in which cases <code>True</code> is kept?</p>
  
  <p>Let's see:</p>
  
  <p>passing a <code>list</code> to build the <code>set</code> instead of using the <code>set</code> notation:</p>
  
  <pre><code>&gt;&gt;&gt; set([True,1])
  {True}
  &gt;&gt;&gt; set([1,True])
  {1}
  </code></pre>
  
  <p>seems logical: <code>set</code> iterates on the inner list, and doesn't add the second element because it is equal to the first element (note that <code>set([True,1])</code> <em>cannot</em> yield <code>1</code>, because <code>set</code> cannot know what's inside the list. It may even not be a <code>list</code> but an <em>iterable</em>)</p>
  
  <p>Now using <code>set</code> notation:</p>
  
  <pre><code>&gt;&gt;&gt; {True,1}
  {1}
  &gt;&gt;&gt; {1,True}
  {True} 
  </code></pre>
  
  <p>It seems that in that case, the list of items is processed in reverse order (tested on Python 2.7 and Python 3.4).</p>
  
  <p>But is that guaranteed? Or just an implementation detail?</p>