A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2002-June/025995.html below:

[Python-Dev] list.extend

[Python-Dev] list.extendDavid 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





RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4