[New-bugs-announce] [issue5822] inconsistent behavior of range when used in combination with remove

Michael Gilbert report at bugs.python.org
Thu Apr 23 21:15:33 CEST 2009


New submission from Michael Gilbert <michael.s.gilbert at gmail.com>:

using range in combination with remove is inconsistent.  for example in 
python 2.x:

>>> x = range(0,3)
>>> x.remove(1)
>>> x
[0, 2]
>>> x = range(0,3).remove(1)
>>> x
>>>

and in python 3.x:
>>> x = list(range(0,3))
>>> x.remove(1)
>>> x
[0, 2]
>>> x = list(range(0,3)).remove(1)
>>> x
>>> 

why does the second approach remove all items from the list?

----------
components: Interpreter Core
messages: 86372
nosy: zero79
severity: normal
status: open
title: inconsistent behavior of range when used in combination with remove
type: behavior
versions: Python 2.5, Python 2.6, Python 3.0, Python 3.1

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


More information about the New-bugs-announce mailing list