Tim Peters added the comment:

It's fine.  Read the docs.  "s.insert(i, x) inserts x into s at the index given 
by i (same as s[i:i] = [x])"

Note that:

>>> fred[-1:]

So the empty slice s[-1:-1] is _between_ 3 and 4 in `fred`.  If you're not 
surprised by

>>> fred[-1]

then you shouldn't be surprised by what `fred.insert(-1, whatever)` does either 

nosy: +tim.peters
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

Python tracker <rep...@bugs.python.org>
Python-bugs-list mailing list

Reply via email to