The benefit of list, dict, and set comprehensions and generator expressions is that they evaluate, as opposed to simply exec. The purpose of making them one-liners is to allow them to be assigned to a variable or passed as an argument.
If you're not assigning or passing, then why not use a newline character? "Sparse is better than dense."
On Friday, June 8, 2018 at 7:13:07 AM UTC-7, Randy Diaz wrote:
I think that the keyword do would solve problems that occur when people want a simple way to run a command over an iterable but they dont want to store the data.
do print(x) for x in range(50)