diff options
author | Andre Delfino <adelfino@gmail.com> | 2020-10-21 08:25:07 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-21 08:25:07 (GMT) |
commit | fb2e94692e3a8eb66915575f4a122d56fe8999a0 (patch) | |
tree | 564155eccc9c8bdd539e59539d31e92aa01bb749 /Doc/faq/programming.rst | |
parent | eba109a28f48b20b05f08abbe6604eebb07788f9 (diff) | |
download | cpython-fb2e94692e3a8eb66915575f4a122d56fe8999a0.zip cpython-fb2e94692e3a8eb66915575f4a122d56fe8999a0.tar.gz cpython-fb2e94692e3a8eb66915575f4a122d56fe8999a0.tar.bz2 |
Doc: Do not suggest `s[::-1]` for reversed order (GH-22457)
Diffstat (limited to 'Doc/faq/programming.rst')
-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 57ab3e2..b75c60a 100644 --- a/Doc/faq/programming.rst +++ b/Doc/faq/programming.rst @@ -1116,7 +1116,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 ... @@ -1124,11 +1124,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? ----------------------------------------- |