I think I like generator comprehension in this case better than either list comprehension or a filter because both of the latter create a new full "result list" before the loop even begins. At least I suppose they do. Also, I think Mitja's suggestion "if not <test>: continue" and Terry's filter function are more readable than comprehensions. It's not a contest though :-), all these variants are great, thank you all! Do you think this discussion is a proof that the following principle got violated, or do you think that "loop with condition" is not such an atomic thing to be subject to this: "There should be one -- and preferably only one -- obvious way to do it." Cheers,
Sergey. -- http://mail.python.org/mailman/listinfo/python-list