title: How to convert a nested Python dict to object?
body: <p>I'm searching for an elegant way to get data using attribute access on a dict with some nested dicts and lists (i.e. javascript-style object syntax).</p>
  
  <p>For example:</p>
  
  <pre><code>&gt;&gt;&gt; d = {'a': 1, 'b': {'c': 2}, 'd': ["hi", {'foo': "bar"}]}
  </code></pre>
  
  <p>Should be accessible in this way:</p>
  
  <pre><code>&gt;&gt;&gt; x = dict2obj(d)
  &gt;&gt;&gt; x.a
  1
  &gt;&gt;&gt; x.b.c
  2
  &gt;&gt;&gt; x.d[1].foo
  bar
  </code></pre>
  
  <p>I think, this is not possible without recursion, but what would be a nice way to get an object style for dicts?</p>