On Sat, 20 Sep 2008 14:20:20 -0700 (PDT), Andrew <[EMAIL PROTECTED]> wrote:
>please explain this behavior to a newb: > >>>> a = [1,2,3,4] >>>> b = ["a","b","c","d"] >>>> a[0:2] = b[0:2] The slice [0:2] represent positions 0 <= x < 2 Replaces the [1, 2] from [1, 2, 3, 4] with ['a', 'b'] Result: a = ['a', 'b', 3, 4] >>>> b[2:4] = a[2:4] The slice [2:4] represent positions 2 <= x < 4 Replaces the ['c', 'd'] from ['a', 'b', 'c', 'd'] with [3, 4] Result: b = ['a', 'b', 3, 4] >>>> a >['a', 'b', 3, 4] >>>> b >['a', 'b', 3, 4] Correct -- http://mail.python.org/mailman/listinfo/python-list