Python O(1) member data access possible?
<p>In C++, for access to 'named' member data, we constantly do:</p>

<pre><code>const unsigned int CHEESE_CAKE = 0;
const unsigned int CHOCOLATE_CAKE = 1;
...
const unsigned int CHERRY_PIE = 1050;
</code></pre>

<p>Then, when we want to access some specific resource matched to the string, we can simply do:</p>

<pre><code>mResource[MyClass::CHEESE_CAKE]; // constant time O(1) access
</code></pre>

<p>I was attempting to do this in python in a similar fashion:</p>

<pre><code>class MyClass:
    MY_CLASS_DATA1 = someData(1)
    MY_CLASS_DATA2 = someData(1)
</code></pre>

<p>But from my understanding, python's member functions are stored in <code>__dict__</code>, which is essentially a hash map giving O(logn) lookup time.</p>

<p>Is there a way achieve O(1) performance in python as in C++, or is this impossible due to python's dynamic nature?</p>
