On Mon, 15 Sep 2014 23:46:03 +0100 Mark Lawrence <breamore...@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])". Although shouldn't that read s[i:i+1] = [x] ?
No, the latter would replace the contents at index i, while the former inserts it (formally, it replaces the 0-length slice with a 1-length slice). Regards Antoine. _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com