Sep-24-2018, 07:33 AM
(Sep-24-2018, 07:05 AM)pystag Wrote: Obviously, the point here isn't to make a list (which is trivial), but to be able to execute commands in a "comprehension fashion".And that is exactly my point. You shouldn't be using a comprehension. Yes, you can write a comprehension that does exactly what you want, but it isn't encouraged. If you care about being "pythonic" write a standard for loop and use multiple lines. If you don't care, knock-yourself out and shove it all into a one line list comp.