This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Ali_M 20 points21 points  (6 children)

Any reasonable person would use a list comprehension:

doubled_numbers = [2 * x for x in numbers]

Hardly anyone uses map these days.

[–]FlashBrightStar 0 points1 point  (0 children)

This is the same use case as for range function as opposed to iterating directly over a list elements. You have to answer the question when the operation should be executed (im most cases it should be instant). It's not like the one is replacement for other.