Python 2.7.3 (default, Feb 27 2014, 19:58:35)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a={1:2}
>>> b={2:3}
>>> id(a)
33107280
>>> id(b)
33070688
>>> c=dict(a, **b)
>>> id(c)
33250240
>>> a
{1: 2}
>>> b
{2: 3}
>>> a.update(b)
>>> a
{1: 2, 2: 3}
>>> id(a)
33107280
>>>
可见,通过dict(a, **b)的方式, 是新创建一个字典, a 与b 均不变。
a.update(b), 将字典b合并到a中,id(a)不变。