Heiko Wundram <[EMAIL PROTECTED]> wrote: > Why isn't this good practice? It's not always sensible to refactor loop code > to call methods (to make the loop body shorter), and it's a pretty general > case that you only want to iterate over part of a generator, not over the > whole content. Because of this, list comprehensions grew the 'if'-clause. So: > why doesn't the for-loop?
List comprehensions grew an if clause because they are expressions that were supposed to replace one of the most the most common idioms in Python: x = [] for i in ...: if ...: x.append(...) And you know what? They've done that very well. Seemingly so well that you are asking for the list comprehension syntax to make it back into for loops. So far, you have failed to convince me (and most others it looks like) that it is a good idea, you have re-hashed the same arguments you made in the PEP, and Guido chimed in as the first message to say: "-1. The contraction just makes it easier to miss the logic." "This was proposed and rejected before." - Guido If you want some advice: let it drop. - Josiah _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com