[issue18770] Python insert operation on list

2013-08-17 Thread Ezio Melotti
Changes by Ezio Melotti : -- stage: -> committed/rejected ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http

[issue18770] Python insert operation on list

2013-08-17 Thread Brett Cannon
Changes by Brett Cannon : -- resolution: -> invalid status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing list U

[issue18770] Python insert operation on list

2013-08-17 Thread Ezio Melotti
Ezio Melotti added the comment: The docs say that: l.insert(pos, val) is equivalent to: l[pos:pos] = [val] The docstring also says that the value is inserted before pos, so .insert is working as documented. -- nosy: +ezio.melotti ___ Python track

[issue18770] Python insert operation on list

2013-08-17 Thread Vivek Ratnaparkhi
New submission from Vivek Ratnaparkhi: Example 1: mylist = ['a','b','c','d','e'] mylist.insert(len(mylist),'f') print(mylist) Output: ['a', 'b', 'c', 'd', 'e', 'f'] Example 2: mylist = ['a','b','c','d','e'] mylist.insert(10,'f') print(mylist) Output: ['a', 'b', 'c', 'd', 'e', 'f'] Why shoul