Message86372
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? |
|
Date |
User |
Action |
Args |
2009-04-23 19:15:33 | zero79 | set | recipients:
+ zero79 |
2009-04-23 19:15:33 | zero79 | set | messageid: <1240514133.74.0.0123263268481.issue5822@psf.upfronthosting.co.za> |
2009-04-23 19:15:31 | zero79 | link | issue5822 messages |
2009-04-23 19:15:30 | zero79 | create | |
|