How do I merge two dictionaries in a single expression (take union of dictionaries)?

I want to merge two dictionaries into a new dictionary. x = {‘a’: 1, ‘b’: 2} y = {‘b’: 10, ‘c’: 11} z = merge(x, y) >>> z {‘a’: 1, ‘b’: 10, ‘c’: 11} Using x.update(y) modifies x in-place instead of creating a new dictionary. I also want the last-one-wins conflict-handling of dict.update() as well. … Read more