John Salerno wrote: >> replaces the elements in the slice by assigned elements. > > > I don't understand the second part of that sentence. I'm assuming "it" > refers to the list being assigned, "replaces the elements" is > self-evident, but what does "by assigned elements" refer to? It seems > when you assign a list to a list slice, nothing gets replaced, the slice > just gets deleted.
>>> x = range(5) >>> x[0:3] = ["a", "b"] >>> x ['a', 'b', 3, 4] Here, '= ["a", "b"]' replaces x[0:3] with ["a", "b"]. When you do '= []', it replaces them with nothing. -- -- http://mail.python.org/mailman/listinfo/python-list