how to join two Dictionary together?

Iain King iainking at gmail.com
Tue Aug 30 11:20:10 EDT 2005


Michael.Coll-Barth at VerizonWireless.com wrote:
> update works like append for lists
>
> a = {}
> a['a']='a'
> a['c']='c'
> b={}
> b['b'] = 'b'
> c={}
> c.update(a)
> c.update(b)
>


So what do you think is the better way to do it, based on speed or
aesthetics?

(1)
c=a.copy()
c.update(b)

or

(2)
c={}
c.update(a)
c.update(b)

Iain




More information about the Python-list mailing list