At 03:39 PM 6/29/2008, John Fouhy wrote:
On 28/06/2008, Dick Moores <[EMAIL PROTECTED]> wrote:
> I'm very familiar with appending x to a list, s, using
s.append(x), however,
> I've never understood what the docs mean by
>
> s.append(x) same as s[len(s):len(s)] = [x]
In addition to Douglas's comment, do you understand how assignment
with slices works?
e.g. can you predict the result of the following operations without trying it?
a = [1, 2, 3, 4]
a[1:3] = [7, 8]
print a
[1, 7, 8, 4] Whew!
(I really wasn't positive that it shouldn't be [1, [7, 8], 4] !)
Dick
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor