Python has pass-by-value semantics, which means that when you pass a parameter to a function, it gets a copy of the object reference, but not the object itself. So, if you reassign a function parameter to something else (like you), the destination is local to the function, the original object "outside" the function remains unchanged. A completely different situation arises if you change something inside the object:
def test(a):
a[0] = 0
lst = [1, 2, 3]
test(lst)
lst
=> [0, 2, 3]
, lst a . - , Python 3.2 clear() ( Python 3.3), here . , Python 2.x 3.x:
def nullity(lst):
del lst[:]