Created
November 2, 2013 22:33
-
-
Save kjaquier/7284242 to your computer and use it in GitHub Desktop.
Python gotcha.
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 test(a=0,b="salut",c=[],d=[]): | |
... a += 1 | |
... b += "!" | |
... c += [2] | |
... d = d + [42] | |
... print a, b, c, d | |
... | |
>>> test() | |
1 salut! [2] [42] | |
>>> test() | |
1 salut! [2, 2] [42] | |
>>> test() | |
1 salut! [2, 2, 2] [42] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment