Passing variable and list to function in Python
<p>I don't understand this behaviour:</p>

<pre><code>def getvariable(v):
    v += 1

def getlist(l):
    l.append(8)

myvariable = 1
mylist = [5, 6, 7]

print myvariable, mylist

getvariable(myvariable)
getlist(mylist)

print myvariable, mylist
</code></pre>

<p>Output:</p>

<pre><code>1 [5, 6, 7]
1 [5, 6, 7, 8]
</code></pre>

<p>Why list changed, but variable doesn't?
How can I change variable in function?
Many people say about passing by value, by reference, by object reference, so I am a bit confused and don't know how it is really.</p>
