JavaScript-like Object in Python standard library?
<p>Quite often, I find myself wanting a simple, "dump" object in Python which behaves like a JavaScript object (ie, its members can be accessed either with <code>.member</code> or with <code>['member']</code>).</p>

<p>Usually I'll just stick this at the top of the <code>.py</code>:</p>

<pre><code>class DumbObject(dict):
    def __getattr__(self, attr):
        return self[attr]
    def __stattr__(self, attr, value):
        self[attr] = value
</code></pre>

<p>But that's kind of lame, and there is at least one bug with that implementation (although I can't remember what it is).</p>

<p>So, is there something similar in the standard library?</p>

<p>And, for the record, simply instanciating <code>object</code> doesn't work:</p>

<pre>
>>> obj = object()
>>> obj.airspeed = 42
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'object' object has no attribute 'airspeed'
</pre>

<p><strong>Edit</strong>: (dang, should have seen this one coming)… Don't worry! I'm not trying to write JavaScript in Python. The place I most often find I want this is while I'm still experimenting: I have a collection of "stuff" that doesn't quite feel right to put in a dictionary, but also doesn't feel right to have its own class.</p>
