"For" loop and list comprehension similarity
peter at engcorp.com
Mon Mar 27 16:01:08 CEST 2006
s.lipnevich at gmail.com wrote:
> 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."
Mitja's suggestion was the one obvious way. The others are all
interesting, maybe even preferable in some cases, but I don't think most
experienced Python programmers would be more likely to start with one of
them than with the simple for-loop-with-explicit-test.
More information about the Python-list