Add two dicts

Afanasiy abelikov72 at
Fri Aug 29 08:17:04 CEST 2003

On Thu, 28 Aug 2003 22:07:06 -0700, Erik Max Francis <max at>

>Afanasiy wrote:
>> Can I add two dicts in a way which is not cumbersome to the above %
>> string
>> operation? Is this another case of writing my own function, or does a
>> builtin (or similar) already exist for this?
>	combinedDict = aDict.copy()
>	combinedDict.update(anotherDict)
>If that's cumbersome, don't really know what you'd consider

Don't really know if you're asking, but :


I would consider that non-cumbersome. ;-)

My only guess why that doesn't exist is that no one decided what to do on
like keys. Use existing, overwrite, or throw exception (my preference). 

More information about the Python-list mailing list