[Python-Dev] list.extend

David Abrahams David Abrahams" <david.abrahams@rcn.com
Thu, 27 Jun 2002 19:47:44 -0400


----- Original Message -----
From: "David Abrahams" <david.abrahams@rcn.com>
To: <python-dev@python.org>
Sent: Thursday, June 27, 2002 7:43 PM
Subject: [Python-Dev] list.extend


> I just submitted a patch to the list.extend docstring, to reflect the
fact
> that x.extend(xrange(10)) and x.extend((2,3)) both work when x is a list.
> Then I went to look at the documentation and noticed it says at
> http://www.python.org/dev/doc/devel/lib/typesseq-mutable.html:
>
> s.extend(x)    same as s[len(s):len(s)] = x    (2)
> ...
> (2) Raises an exception when x is not a list object. The extend() method
is
> experimental and not supported by mutable sequence types other than
lists.
>
>
> Now I'm wondering what all this means. It is /not/ equivalent to the
slice
> assignment, because list slice assignment requires a list rhs. What does
> this "experimental" label mean? Is my patch to the docstring wrong, in
the
> sense that it suggests exploiting undefined behavior in the same way that
> the old append-multiple-items behavior was undefined?

Looking again, I note that even if my patch is wrong, either the doc or the
implementation must be fixed since it currently lies about throwing an
exception when x is not a list. If someone can channel me the right state
of affairs I'll submit another patch.

-Dave