diff options
author | Miss Skeleton (bot) <31488909+miss-islington@users.noreply.github.com> | 2020-10-21 08:34:36 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-21 08:34:36 (GMT) |
commit | 62eb403ad5caa4b7cc2b105699373254b2908ebb (patch) | |
tree | 9046b51e7548c620cc4e9983a1f7d55a9b715287 /Doc/faq | |
parent | 490f30dacdd4909aa055b800f5ac9dd0f57d56b8 (diff) | |
download | cpython-62eb403ad5caa4b7cc2b105699373254b2908ebb.zip cpython-62eb403ad5caa4b7cc2b105699373254b2908ebb.tar.gz cpython-62eb403ad5caa4b7cc2b105699373254b2908ebb.tar.bz2 |
Doc: Do not suggest `s[::-1]` for reversed order (GH-22457)
(cherry picked from commit fb2e94692e3a8eb66915575f4a122d56fe8999a0)
Co-authored-by: Andre Delfino <adelfino@gmail.com>
Diffstat (limited to 'Doc/faq')
-rw-r--r-- | Doc/faq/programming.rst | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/Doc/faq/programming.rst b/Doc/faq/programming.rst index a64e8ac..b16b8c8 100644 --- a/Doc/faq/programming.rst +++ b/Doc/faq/programming.rst @@ -1121,7 +1121,7 @@ trailing newline from a string. How do I iterate over a sequence in reverse order? -------------------------------------------------- -Use the :func:`reversed` built-in function, which is new in Python 2.4:: +Use the :func:`reversed` built-in function:: for x in reversed(sequence): ... # do something with x ... @@ -1129,11 +1129,6 @@ Use the :func:`reversed` built-in function, which is new in Python 2.4:: This won't touch your original sequence, but build a new copy with reversed order to iterate over. -With Python 2.3, you can use an extended slice syntax:: - - for x in sequence[::-1]: - ... # do something with x ... - How do you remove duplicates from a list? ----------------------------------------- |