Python dict.fromkeys return same id element
<p>When i do this on python i update all keys in one time.</p>

<pre><code>&gt;&gt;&gt; base = {}
&gt;&gt;&gt; keys = ['a', 'b', 'c']
&gt;&gt;&gt; base.update(dict.fromkeys(keys, {}))
&gt;&gt;&gt; base.get('a')['d'] = {}
&gt;&gt;&gt; base
{'a': {'d': {}}, 'c': {'d': {}}, 'b': {'d': {}}}
&gt;&gt;&gt; map(id, base.values())
[140536040273352, 140536040273352, 140536040273352]
</code></pre>

<p>If instead of <code>.get</code> i use <code>[]</code> operator this not happen:</p>

<pre><code>&gt;&gt;&gt; base['a']['d'] = {}
&gt;&gt;&gt; base
{'a': {'d': {}}, 'c': {}, 'b': {}}
</code></pre>

<p>Why?</p>

<p>When you initialize the value for the new keys as <code>{}</code> a new dictionary is created and a reference to this dictionary is becoming the values. There is only one dictionary and so if you change one, you will change "all".</p>

python dictionary