Skip to content

Instantly share code, notes, and snippets.

@bngsudheer
Created November 23, 2015 09:12
Show Gist options
  • Save bngsudheer/5959a9cdcb64fbfdfc5c to your computer and use it in GitHub Desktop.
Save bngsudheer/5959a9cdcb64fbfdfc5c to your computer and use it in GitHub Desktop.
Pass keyword arguments using a dictionary
# You can nicely pass the dictionary items as keyword arguments
def my_function(a, b, c):
print a, b, c
# Pass keyword arguments
my_function(a=10, b=20, c=30)
args_dict = {'a': 100, 'b': 200, 'c':300}
# Pass keyword arguments using a dictionary
# The dictionary keys map to names of the keyword arguments
my_function(**args_dict)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment