Matimus wrote:

May I suggest you look into using `enumerate`:

for i, val in enumerate([4,5,6]):
...  print i, val
...
0 4
1 5
2 6

It allows you to get the index and the value at the same time, which
should eliminate the need for `aList.index`.

I thought of suggesting that, but indirectly iterating over a list that is being modified with enumerate has the same problem as directly interating over the same changing list.

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to