Created
July 7, 2015 03:24
-
-
Save wwj718/f22b5c253e1576594073 to your computer and use it in GitHub Desktop.
update_with_kwargs.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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