[Python-Dev] list.extend

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


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?

Also, I note that the table referenced above seems to be missing some right
parentheses, at least on the .pop and .sort method descriptions.

-Dave


+---------------------------------------------------------------+
                  David Abrahams
      C++ Booster (http://www.boost.org)               O__  ==
      Pythonista (http://www.python.org)              c/ /'_ ==
  resume: http://users.rcn.com/abrahams/resume.html  (*) \(*) ==
          email: david.abrahams@rcn.com
+---------------------------------------------------------------+