What is the difference between
def delete_head1(t):
    #t[:] = t[1:]
    t = t[1:]
and
def delete_head2(t):
    t[:] = t[1:]
    #t = t[1:]
Why does the second one modify the input but not the first? That is, if I do
k=[1,2,3]
delete_head1(k)
print(k)
versus
k=[1,2,3]
delete_head2(k)
print(k)
The results are different.
As I understand, the first one, in its body, creates and refers to a local variable t. Why isn't the second one also referring to a local variable t?
If in the body of the function I have:
t = t[1:]
the interpreter recognizes the second t (the one after the equals sign) but not the first t (the one before the equals sign)?
But this is not the case if I write
t[:] = t[1:]
In this last statement it recognizes both t? What is the guiding principle here for Python?
 
     
    