Issue #16225: Backport from 3.2: Add additional note to tutorial about looping.
diff --git a/Doc/tutorial/datastructures.rst b/Doc/tutorial/datastructures.rst
index f55674e..88ab372 100644
--- a/Doc/tutorial/datastructures.rst
+++ b/Doc/tutorial/datastructures.rst
@@ -645,6 +645,19 @@
gallahad the pure
robin the brave
+To change a sequence you are iterating over while inside the loop (for
+example to duplicate certain items), it is recommended that you first make
+a copy. Looping over a sequence does not implicitly make a copy. The slice
+notation makes this especially convenient::
+
+ >>> words = ['cat', 'window', 'defenestrate']
+ >>> for w in words[:]: # Loop over a slice copy of the entire list.
+ ... if len(w) > 6:
+ ... words.insert(0, w)
+ ...
+ >>> words
+ ['defenestrate', 'cat', 'window', 'defenestrate']
+
.. _tut-conditions: