Sep-23-2018, 09:58 AM
It would be nice if python supported this kind of "expression comprehension", or do it?
I frecuently encounter situations in which I need to execute some function for a list of things, or a range of whatever, and wonder if it could be done in a one-liner like the message title. I know we have map's, and for's but I think this feels more natural and "pythonic"
Is there a syntax I'm not aware of? Or maybe someone proposed this in the past but coulnd't be done for any unwanted effects?
I frecuently encounter situations in which I need to execute some function for a list of things, or a range of whatever, and wonder if it could be done in a one-liner like the message title. I know we have map's, and for's but I think this feels more natural and "pythonic"
Is there a syntax I'm not aware of? Or maybe someone proposed this in the past but coulnd't be done for any unwanted effects?