Skip to content

Instantly share code, notes, and snippets.

@anthonywu
Created February 29, 2012 23:13
Show Gist options
  • Save anthonywu/1945279 to your computer and use it in GitHub Desktop.
Save anthonywu/1945279 to your computer and use it in GitHub Desktop.
Python args tuple unpacking
def foobar(a, b, c, (username, password)=(None,None)):
print a, b, c, username, password
foobar(1, 2, 3, ('hello','world')) # 1 2 3 hello world
foobar(1, 2, 3) # prints "1 2 3 None None"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment