Hacker News new | ask | show | jobs
by Kpourdeilami 3201 days ago
They get overwritten by the value of the dictionary that came last.

  >>> dict1 = {"key1": 1, "key2": "hello", "key3": [1, 2, 3]}
  >>> dict2 = {key1": 1, "key2": "world", "key3": [1, 4], "key4": "4"}

  >>> {**dict1, **dict2}
  {'key1': 1, 'key2': 'world', 'key3': [1, 4], 'key4': '4'}
1 comments

Lots of code to show that. How 'bout this: ;-)

  >>> {**{'a': 'first'}, **{'a': 'second'}}
  {'a': 'second'}