How is the .pop() method able to redefine a variable by only being the value of another?
<p>So in python if you create your <code>list</code>, then a new variable, <code>reject_list</code> and assign it the <code>.pop()</code> method, it changes the value in the previous <code>list</code> variable. </p>

<pre><code>list = ['item', 'thing', 'piece']
reject_list = list.pop()
print(list)

['item', 'thing']
</code></pre>

<p>I understand this effect, but not how it's possible. How does assigning the method of one variable as the value of another retroactively change the value of the original variable without first being defined, like this: </p>

<pre><code>list = ['item', 'thing', 'piece']
list = list.pop()    
print(list)

['item', 'thing']
</code></pre>

<p>For instance, this doesn't work with the <code>.title()</code> method: </p>

<pre><code>name = mike 
new_name = name.title() 
print(name)

mike
#the original name did not capitalize
</code></pre>

<p>so how is the .pop() method able to redefine a variable by only being the value of another?</p>

<p>Your explanation of what you're seeing is not correct. The change in the value of <code>list</code> has nothing to do with you assigning the result of <code>list.pop()</code> to <code>reject_list</code>.</p>

<p>Python is an object-based language which means the basic element of data in it are <em>objects</em>, which are a collection of data (or <em>state</em>) and functions (called <em>methods</em>). Methods can access the state contained in the object they are called on and they can modify it. In the case of list, its elements are its state. The behaviour of <code>pop()</code> is to modify this state by removing the last element of the list it was called on and returning it. Therefore, after calling it, the original list is shorter by one element.</p>

<p>Have a look at this example:</p>

<pre><code>&gt;&gt;&gt; a = [1, 2, 3]
&gt;&gt;&gt; b = a          # the name "b" refers to the same list as the name "a"
&gt;&gt;&gt; a.pop()        # we pop off a value but don't assign it anywhere
3
&gt;&gt;&gt; a
[1, 2]
&gt;&gt;&gt; b
[1, 2]
</code></pre>

<p>Note that the result of <code>a.pop()</code> isn't assigned to anything but <code>a</code> is still changed. You can think of the meaning of <code>a.pop()</code> as "remove the last element of the list a (while also returning it as a result)".</p>

<p>Also note that it is not a good idea to use the name <code>list</code> since it is a builtin identifier referring to the list type itself and you are redefining it.</p>

python methods