Remove items from a list while iterating without using extra memory in Python,li = [x for x in li if condition(x)]