Michael Gilbert added the comment:
ok, i see now. the list itself is changed in place, and the return value
of the remove() method is always None. since i din't assign the list to a
variable in the first place, there is hence no way now to access that
modified list.
thanks for your help.
R. David Murray added the comment:
>>> [1,2,3].remove(1)
>>> repr([1,2,3].remove(1))
'None'
The remove method mutates the list, and therefore like all such mutating
methods, it returns None.
--
nosy: +r.david.murray
resolution: -> invalid
stage: -> committed/rejected
status: open ->
New submission from Michael Gilbert :
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