"Peter Hansen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> It's not even clear that extend needs two lines:
>
> >>> s = range(5)
> >>> more = list('abc')
> >>> s[:] = s + more
> >>> s
> [0, 1, 2, 3, 4, 'a', 'b', 'c']
This is not the same as list.extend because it makes a separate
intermediate list instead of doing the extension completely in place.
However, the following does mimic .extend.
>>> s=range(5)
>>> s[len(s):] = list('abc')
>>> s
[0, 1, 2, 3, 4, 'a', 'b', 'c']
So. at the cost of writing and calling len(s), you are correct that .extend
is not necessary.
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list