На этот вопрос уже есть ответ здесь:
Я просматриваю список элементов в Python, выполняю некоторые действия с ним, а затем удаляю их, если они соответствуют определенным критериям.
for element in somelist:
do_action(element)
if check(element):
remove_element_from_list
Что мне следует использовать вместо remove_element? I have seen similar questions asked, but notice the presence of the do_action part that is to be executed for all elements and thus eliminates the solution of using filters.