Created
July 25, 2013 16:10
-
-
Save benjamingeiger/6081268 to your computer and use it in GitHub Desktop.
Are lists passed by reference?
This file contains 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
In [1]: foo = [1, 2, 3, 4, 5] | |
In [2]: def bar(lst): | |
...: lst.append(6) | |
...: | |
In [3]: bar(foo) | |
In [4]: foo | |
Out[4]: [1, 2, 3, 4, 5, 6] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment