Removing redundancy when adding items to Python dictionaries
<p>Suppose you have a dictionary like:</p>

<pre><code>my_dict = {'foo' : {'bar' : {}}}
</code></pre>

<p>And you want to make the following sequence of assignments:</p>

<pre><code>my_dict['foo']['bar']['first'] = 1
my_dict['foo']['bar']['second'] = 2
</code></pre>

<p>Clearly there is some redundancy in the fact that <code>my_dict['foo']['bar']</code> is repeated. Is there any way to prevent this redundancy?</p>

<p>Thanks!</p>
