Skip to content

Instantly share code, notes, and snippets.

@hashlash
Last active May 14, 2019 02:13
Show Gist options
  • Save hashlash/ba33c260ec08e26f21c082dbf30bd766 to your computer and use it in GitHub Desktop.
Save hashlash/ba33c260ec08e26f21c082dbf30bd766 to your computer and use it in GitHub Desktop.
Simple example for using asterisks for unpacking variables
# function with unpacked parameter
def func1(**kwargs):
print(kwargs)
# both function call are the identical
func1(var1='hello', var2='world', var3='!')
func1(**{'var1':'hello', 'var2':'world', 'var3':'!'})
# this one throw error
func1({'var1':'hello', 'var2':'world', 'var3':'!'})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment