[New-bugs-announce] [issue18770] Python insert operation on list

Vivek Ratnaparkhi report at bugs.python.org
Sat Aug 17 20:03:06 CEST 2013


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 should mylist.insert(len(mylist), x) be equivalent to mylist.insert(len(mylist)+1000000000, x)

Excepted Output: Should give index error.

----------
messages: 195497
nosy: vivek.ratnaparkhi
priority: normal
severity: normal
status: open
title: Python insert operation on list
type: enhancement
versions: Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18770>
_______________________________________


More information about the New-bugs-announce mailing list