Skip to content

Instantly share code, notes, and snippets.

@bittner
Created March 21, 2015 23:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bittner/012d0287ebdcacdab95a to your computer and use it in GitHub Desktop.
Save bittner/012d0287ebdcacdab95a to your computer and use it in GitHub Desktop.
def merge_dicts(*dict_args):
"""
Given any number of dicts, shallow copy and merge into a new dict,
precedence goes to key value pairs in latter dicts.
"""
result = {}
for dictionary in dict_args:
result.update(dictionary)
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment