Re: [Python-Dev] List insert at index that is well out of range - behaves like append

2014年9月15日 15:59:56 -0700

On Mon, Sep 15, 2014 at 3:46 PM, Mark Lawrence <[email protected]>
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)
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to