practising some python, which is a pretty easy language to grab up.
I have
>>> L = [1,2,3,4]
>>> L[1:1] = [1,2,3]
>>> L
[1
The official Python Tutorial explains it best, in my opinion. The end of Chapter 3.1.2 has the following diagram:
+---+---+---+---+---+
| H | e | l | p | A |
+---+---+---+---+---+
0 1 2 3 4 5
What this illustrates is that you can think of the indices as pointing BETWEEN the elements. So in this illustration, if specifying a slice [1:1]
, you are actually referring to the space between H
and e
, but not including them.
If you wanted to overwrite H
and e
, you would specify the slice [0:2]
.