3 ms·
you can consider a list comprehension to be a sort of literal representation of the result of map. I think literals have a benefit for code readability and shou
by metaphorm 12y ago
you can consider a list comprehension to be a sort of literal representation of the result of map. I think literals have a benefit for code readability and should be used when feasible (i.e. the literal is compact enough).
the other reason its considered more idiomatic in Python is just because the compiler does a better job of parsing and optimizing list comprehensions.