Order of results from python's dir() function
<p>The <code>dir()</code>of a class can be customized by creating a special function which returns a user-defined list, so why does it not maintain the order I specified?  Here's an example:</p>

<pre><code>&gt;&gt;&gt; class C(object):
...   def __dir__(self):
...     return ['a', 'c', 'b']
...
&gt;&gt;&gt; c = C()
&gt;&gt;&gt; dir(c)
['a', 'b', 'c']
</code></pre>

<p>Why is <code>dir()</code> seemingly sorting my list and returning <code>['a', 'b', 'c']</code> rather than <code>['a', 'c', 'b']</code>?  </p>

<p>Oddly (to me), calling the member function directly yields the expected results:</p>

<pre><code>&gt;&gt;&gt; c.__dir__()
['a', 'c', 'b']
</code></pre>
