Skip to content

Instantly share code, notes, and snippets.

@benjamingeiger
Created July 25, 2013 16:10
Show Gist options
  • Save benjamingeiger/6081268 to your computer and use it in GitHub Desktop.
Save benjamingeiger/6081268 to your computer and use it in GitHub Desktop.
Are lists passed by reference?
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