diff options
author | Martin Panter <vadmium+py@gmail.com> | 2015-10-03 07:37:22 (GMT) |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2015-10-03 07:37:22 (GMT) |
commit | fcf58a151824d9af5962248fc176dc5749138eac (patch) | |
tree | f4b31a341c605c897e68c34ebbbfd6d327e49b52 /Doc | |
parent | 74c76c8f06c60698a23289abc48d23b9b4ea6c27 (diff) | |
download | cpython-fcf58a151824d9af5962248fc176dc5749138eac.zip cpython-fcf58a151824d9af5962248fc176dc5749138eac.tar.gz cpython-fcf58a151824d9af5962248fc176dc5749138eac.tar.bz2 |
Issue #16701: Document += and *= for mutable sequences
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/stdtypes.rst | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 86aae51..94bfac1 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -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: |