In Python, is it better to use list comprehensions or for-each loops?

If the iteration is being done for its side effect ( as it is in your “print” example ), then a loop is clearer.

If the iteration is executed in order to build a composite value, then list comprehensions are usually more readable.

Leave a Comment