diff options
author | Martin Panter <vadmium+py@gmail.com> | 2016-12-24 08:31:37 (GMT) |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2016-12-24 08:31:37 (GMT) |
commit | 9fa6374925b23cb94466ea7dab5d018aadf7b963 (patch) | |
tree | aa87049a7d6c74a3b8d19664fca51b7a5ccff5b7 /Doc/library/stdtypes.rst | |
parent | 9e40afe20a73be393e89b62f8749392fcac09811 (diff) | |
parent | 0efb5b353865cdbc8648466446454c7e6f26472d (diff) | |
download | cpython-9fa6374925b23cb94466ea7dab5d018aadf7b963.zip cpython-9fa6374925b23cb94466ea7dab5d018aadf7b963.tar.gz cpython-9fa6374925b23cb94466ea7dab5d018aadf7b963.tar.bz2 |
Issue #1446619: Merge slicing description from 3.6
Diffstat (limited to 'Doc/library/stdtypes.rst')
-rw-r--r-- | Doc/library/stdtypes.rst | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 982d9f8..f4a54f4 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -942,8 +942,10 @@ Notes: The slice of *s* from *i* to *j* with step *k* is defined as the sequence of items with index ``x = i + n*k`` such that ``0 <= n < (j-i)/k``. In other words, the indices are ``i``, ``i+k``, ``i+2*k``, ``i+3*k`` and so on, stopping when - *j* is reached (but never including *j*). If *i* or *j* is greater than - ``len(s)``, use ``len(s)``. If *i* or *j* are omitted or ``None``, they become + *j* is reached (but never including *j*). When *k* is positive, + *i* and *j* are reduced to ``len(s)`` if they are greater. + When *k* is negative, *i* and *j* are reduced to ``len(s) - 1`` if + they are greater. If *i* or *j* are omitted or ``None``, they become "end" values (which end depends on the sign of *k*). Note, *k* cannot be zero. If *k* is ``None``, it is treated like ``1``. |