My problem is simple: I have a long list of elements that I want to iterate through and check every element against a condition. Depending on the outcome of the condition I
li = [ x for x in li if condition(x)]
and also
li = filter(condition,li)
Thanks to Dave Kirby