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>The answer is that the <code>list.pop()</code> method specifically modifies the object; <strong>removes</strong> and returns an item from the list. <code>str.title()</code> returns a <em>version</em> of the string in title case, but does not modify the string itself.</p>

<p>It's also noteworthy that strings are immutable in Python.</p>

<pre><code>my_list = ["a", "b", "c"]
popped_element = my_list.pop()
print(my_list)
#['a', 'b']
print(popped_element)
#'c'
</code></pre>

python methods