Here is the simple example
>>> list=[(1,2),(3,4),(5,6)]
>>> for i in list:
... print(i)
... list.remove(i)
...
(1, 2)
(5, 6)
>>> list
[(3, 4)]
>>>
My intention was to print and element and remove it but it seems that the next element gets removed though that is also not true as unprinted element got restored after loop.
Can you explain this behaviour ?
Is this a bug or my method is incorrect ?
Is it possible to do in-place removal without using another copy of list ?
Thanks.