]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #16701: Document += and *= for mutable sequences
authorMartin Panter <vadmium+py@gmail.com>
Sat, 3 Oct 2015 07:37:22 +0000 (07:37 +0000)
committerMartin Panter <vadmium+py@gmail.com>
Sat, 3 Oct 2015 07:37:22 +0000 (07:37 +0000)
Doc/library/stdtypes.rst

index 86aae512c4f2c588c8c0b53b2192b4570573ce6b..94bfac1ead2627fb90d187eca78bfc64fd58cabd 100644 (file)
@@ -1613,8 +1613,11 @@ an arbitrary object):
 | ``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 @@ Notes:
       :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: