yes. i think it does so. it take me the whole afternoon to find out the bug (mine) i change: for i in range(len(j) -1, -1, -1): d = j[i] if d <= 10: j.remove(d)
the real code is not so simple,so j[11:] will not work for me. but, i think phthon could found that i remove the current element, why it does not move the pointer automatically? for python, i am a newbie, but i did not found the warning of such usage from the python tutorial <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > it is not python bug. > You refer the list j and remove the element in the same time, that is > the problem. Python dinamicaly goes to the next element with the same > index but apply it in the new list. > > use this code instead: > j = range(20) > print j > L = [x for x in j if x > 10] > print L > > Sincerely Yours, > Pujo > -- http://mail.python.org/mailman/listinfo/python-list