[Python-checkins] cpython (3.4): 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/f83db23bec7f
changeset: 98518:f83db23bec7f
branch: 3.4
parent: 98510:634fe6a90e0c
user: Martin Panter <vadmium+py at gmail.com>
date: Sat Oct 03 07:46:04 2015 +0000
summary:
 Issue #16701: Document += and *= for mutable sequences
files:
 Doc/library/stdtypes.rst | 14 ++++++++++++--
 1 files changed, 12 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
@@ -1063,10 +1063,14 @@
 | ``s.copy()`` | creates a shallow copy of ``s``| \(5) |
 | | (same as ``s[:]``) | |
 +------------------------------+--------------------------------+---------------------+
-| ``s.extend(t)`` | extends *s* with the | |
-| | contents of *t* (same as | |
+| ``s.extend(t)`` or | extends *s* with the | |
+| ``s += t`` | contents of *t* (for the | |
+| | most part the same as | |
 | | ``s[len(s):len(s)] = t``) | |
 +------------------------------+--------------------------------+---------------------+
+| ``s *= n`` | updates *s* with its contents | \(6) |
+| | repeated *n* times | |
++------------------------------+--------------------------------+---------------------+
 | ``s.insert(i, x)`` | inserts *x* into *s* at the | |
 | | index given by *i* | |
 | | (same as ``s[i:i] = [x]``) | |
@@ -1107,6 +1111,12 @@
 .. versionadded:: 3.3
 :meth:`clear` and :meth:`!copy` methods.
 
+(6)
+ 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-common`.
+
 
 .. _typesseq-list:
 
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /