@@ -854,8 +854,8 @@ operations have the same priority as the corresponding numeric operations.
854
854
| ``s + t `` | the concatenation of *s * and | (6)(7) |
855
855
| | *t * | |
856
856
+--------------------------+--------------------------------+----------+
857
- | ``s * n `` or | * n * shallow copies of *s * | (2)(7) |
858
- | ``n * s `` | concatenated | |
857
+ | ``s * n `` or | equivalent to adding *s * to | (2)(7) |
858
+ | ``n * s `` | itself * n * times | |
859
859
+--------------------------+--------------------------------+----------+
860
860
| ``s[i] `` | *i *\ th item of *s *, origin 0 | \( 3) |
861
861
+--------------------------+--------------------------------+----------+
@@ -897,9 +897,9 @@ Notes:
897
897
898
898
(2)
899
899
Values of *n * less than ``0 `` are treated as ``0 `` (which yields an empty
900
- sequence of the same type as *s *). Note also that the copies are shallow;
901
- nested structures are not copied. This often haunts new Python programmers;
902
- consider::
900
+ sequence of the same type as *s *). Note that items in the sequence * s *
901
+ are not copied; they are referenced multiple times . This often haunts
902
+ new Python programmers; consider::
903
903
904
904
>>> lists = [[]] * 3
905
905
>>> lists
@@ -909,7 +909,7 @@ Notes:
909
909
[[3], [3], [3]]
910
910
911
911
What has happened is that ``[[]] `` is a one-element list containing an empty
912
- list, so all three elements of ``[[]] * 3 `` are (pointers to) this single empty
912
+ list, so all three elements of ``[[]] * 3 `` are references to this single empty
913
913
list. Modifying any of the elements of ``lists `` modifies this single list.
914
914
You can create a list of different lists this way::
915
915
@@ -920,6 +920,9 @@ Notes:
920
920
>>> lists
921
921
[[3], [5], [7]]
922
922
923
+ Further explanation is available in the FAQ entry
924
+ :ref: `faq-multidimensional-list `.
925
+
923
926
(3)
924
927
If *i * or *j * is negative, the index is relative to the end of the string:
925
928
``len(s) + i `` or ``len(s) + j `` is substituted. But note that ``-0 `` is
0 commit comments