Skip to content

Instantly share code, notes, and snippets.

@wwj718
Created July 7, 2015 03:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wwj718/f22b5c253e1576594073 to your computer and use it in GitHub Desktop.
Save wwj718/f22b5c253e1576594073 to your computer and use it in GitHub Desktop.
update_with_kwargs.py
def _update_with_kwargs(data_dict, **kwargs):
"""Updates a dict from kwargs only if it modifies a top-level value."""
for key, value in kwargs.iteritems():
if key in data_dict:
data_dict[key] = value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment