The behavior of List.insert

badchoice at gmx.li badchoice at gmx.li
Thu May 1 08:02:04 EDT 2003


> 
> mylist = [1,2,3,4,5], 
> 
> mylist.insert(-1,99) will make mylist to be [99,1,2,3,4,5]
> 
> just wonder why not let it to be [1,2,3,4,99,5]
> 

http://rgruet.free.fr/PQR2.2.html
s.insert(i, x) same as s[i:i] = [x] if i >= 0




More information about the Python-list mailing list