Skip to content

Instantly share code, notes, and snippets.

@gerow
Created November 16, 2016 23:23
Show Gist options
  • Save gerow/decfd75d803aa88e797f87cd6d64fc92 to your computer and use it in GitHub Desktop.
Save gerow/decfd75d803aa88e797f87cd6d64fc92 to your computer and use it in GitHub Desktop.
gerow@gerow0:~$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> l = ['why are lists pass by reference by default in python?']
>>> def f(l):
... l.append('because fuck you')
...
>>> f(l)
>>> l
['why are lists pass by reference by default in python?', 'because fuck you']
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment