def remove_all(v):
    """Remove all instances of ``v`` from ``lst``"""
try:
    while True:
        lst.remove(v)
except ValueError:
    pass
values = set(lst)
for v in values:
    if not pred(v):
        remove_all(v)
what is a quick way to delete all elements from a list that do not satisfy a constraint?