Fwd: PYTHON BUG. deleting elements of list.

Mats Wichmann mats at python.org
Wed Sep 9 10:04:52 EDT 2020


On 9/8/20 5:18 PM, Richard Damon wrote:
> On 9/8/20 7:06 PM, Mats Wichmann wrote:
>> On 9/7/20 5:01 PM, Driuma Nikita wrote:

>>     for i, el in enumerate(_list[:]):
>>          del _list[i]
>>
> The issue isn't so much that he is modifying the list that he is
> iterating over, but also when he deletes _list[0], all the other
> elements move down,

yes, quite right, brain fail here, ignore me....


More information about the Python-list mailing list