3 ms·
Some people consider an abuse of list comprehensions if you use them just for the side effects. Why not just a plain for loop? for t in threads: t.start()
by scardine 11y ago
Some people consider an abuse of list comprehensions if you use them just for the side effects. Why not just a plain for loop?
for t in threads: t.start()
- aidos 11y agoBelieve it or not, it's the first time I've used a list comprehension for execution like that (other than when working interactively in ipython)! Originally I had a comment about how it was a non-idiomatic thing to do, but I deleted it. What's strange is that I didn't even consider writing the for loop on a single line. I just never do that. It's clearly better in this case (than a list comprehension). In real code I'd just do it on 2 lines.