Commit 0fcd8821 authored by Georg Brandl's avatar Georg Brandl

Introduce copy by slicing, used in later chapters.

parent d1068be6
......@@ -523,6 +523,12 @@ concatenated and so on::
>>> 3*a[:3] + ['Boo!']
['spam', 'eggs', 100, 'spam', 'eggs', 100, 'spam', 'eggs', 100, 'Boo!']
All slice operations return a new list containing the requested elements. This
means that the following slice returns a shallow copy of the list *a*::
>>> a[:]
['spam', 'eggs', 100, 1234]
Unlike strings, which are *immutable*, it is possible to change individual
elements of a list::
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment