(original) (raw)



On Mon, Sep 15, 2014 at 3:46 PM, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:

I assume it's based on the concepts of slicing. From the docs "s.insert(i, x) - inserts x into s at the index given by i (same as s\[i:i\] = \[x\])".

Ah, right. It matches thigs like s\[100:\] which is the empty string if s is shorter than 100.
Although shouldn't that read s\[i:i+1\] = \[x\] ?

Should've stopped while you were ahead. :-)

'Nuff said.
--
--Guido van Rossum (python.org/\~guido)