Understanding Python list.append behavior -


why in following example appending big_l in for loop changes last lists added big_l?

l=[1,2,3,4,5]  big_l=[]  def f(ll):     x=ll.pop(0)     ll.append(x)     return ll  in range(4):     big_l.append(l)     print l,big_l     l=f(l) 

it prints:

[1, 2, 3, 4, 5] - [[1, 2, 3, 4, 5]] [2, 3, 4, 5, 1] - [[2, 3, 4, 5, 1], [2, 3, 4, 5, 1]] [3, 4, 5, 1, 2] - [[3, 4, 5, 1, 2], [3, 4, 5, 1, 2], [3, 4, 5, 1, 2]] [4, 5, 1, 2, 3] - [[4, 5, 1, 2, 3], [4, 5, 1, 2, 3], [4, 5, 1, 2, 3], [4, 5, 1, 2, 3]]