Abnormal behavior of python's set function : <p>I was working on a problem which required the use of python's set function to be applied onto strings.
This is what I observed which is baffling me. 
Please do tell me a reason as to why it occurs if anyone does know.</p>

<pre><code>&gt;&gt;&gt; set('123456789')
{'2', '6', '7', '5', '9', '1', '8', '4', '3'}
&gt;&gt;&gt; set('123456789')
{'2', '6', '5', '7', '9', '1', '8', '4', '3'}
&gt;&gt;&gt; set('132457689')
{'2', '6', '5', '7', '9', '1', '8', '4', '3'}
&gt;&gt;&gt; set('122333444455555666666777777788888888999999999')
{'2', '6', '5', '7', '9', '1', '8', '4', '3'}
&gt;&gt;&gt; &gt;&gt;&gt; set('1223334444555556666667777777888888889999999991324354657869874645231232435465768986753514324354657698587647536425312635746587873562413237485769546372641495565364319483726415523648759648573462')
{'2', '6', '5', '7', '9', '1', '8', '4', '3'}
</code></pre>

<p>Despite the number of times or the order in which the elements(1-9) in the string are passed, they seem to get arranged in this strange pattern after execution.</p>

<p>So I thought to generalize this and see. Here is what I observed when I applied it on a-z and 0-9 all combined</p>

<pre><code>&gt;&gt;&gt; set('1234567890qwertyuiopasdfghjklzxcvbnm')
{'r', 'p', '9', '8', 'l', 'c', 't', 's', '5', 'g', '0', '4', 'q', 'b', 'a', 'i', 'x', 'w', 'o', 'z', 'n', 'm', '2', '6', 'u', 'j', '7', 'd', '1', 'e', 'v', 'k', '3', 'f', 'y', 'h'}
&gt;&gt;&gt; set('1234567890qwertyuiopasdfghjklzxcvbnm'[::-1])
{'r', 'p', '9', '8', 'c', 'l', 't', 's', '5', 'g', '0', 'q', '4', 'b', 'a', 'i', 'x', 'w', 'o', 'z', 'n', 'm', '2', '6', 'j', 'u', '7', 'd', '1', 'e', 'v', 'k', '3', 'f', 'y', 'h'}
</code></pre>

<p>The order comes out to be different. 
'c' &amp; 'l' are flipped.
'4' &amp; 'q' are flipped.
'j' &amp; 'u' are flipped.</p>

<p>But something even crazier is this</p>

<pre><code>&gt;&gt;&gt; set('1234567890qwertyuiopasdfghjklzxcvbnm') ==  set('1234567890qwertyuiopasdfghjklzxcvbnm'[::-1])
True
</code></pre>

<p>Any information about why this behavior occurs is much appreciated. Thank you.</p>
