[Python-checkins] cpython (2.7): Issue #16701: Document += and *= for mutable sequences
martin.panter
python-checkins at python.org
Sat Oct 3 04:02:22 EDT 2015
https://hg.python.org/cpython/rev/ec373d762213
changeset: 98517:ec373d762213
branch: 2.7
user: Martin Panter <vadmium+py at gmail.com>
date: Sat Oct 03 07:37:22 2015 +0000
summary:
Issue #16701: Document += and *= for mutable sequences
files:
Doc/library/stdtypes.rst | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -1613,8 +1613,11 @@
| ``s.append(x)`` | same as ``s[len(s):len(s)] = | \(2) |
| | [x]`` | |
+------------------------------+--------------------------------+---------------------+
-| ``s.extend(x)`` | same as ``s[len(s):len(s)] = | \(3) |
-| | x`` | |
+| ``s.extend(x)`` or | for the most part the same as | \(3) |
+| ``s += t`` | ``s[len(s):len(s)] = x`` | |
++------------------------------+--------------------------------+---------------------+
+| ``s *= n`` | updates *s* with its contents | \(11) |
+| | repeated *n* times | |
+------------------------------+--------------------------------+---------------------+
| ``s.count(x)`` | return number of *i*'s for | |
| | which ``s[i] == x`` | |
@@ -1720,6 +1723,12 @@
:exc:`ValueError` if it can detect that the list has been mutated during a
sort.
+(11)
+ The value *n* is an integer, or an object implementing
+ :meth:`~object.__index__`. Zero and negative values of *n* clear
+ the sequence. Items in the sequence are not copied; they are referenced
+ multiple times, as explained for ``s * n`` under :ref:`typesseq`.
+
.. _types-set:
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list