Created
February 29, 2012 23:13
-
-
Save anthonywu/1945279 to your computer and use it in GitHub Desktop.
Python args tuple unpacking
This file contains hidden or 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 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