Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

List comprehension vs map

Is there a reason to prefer using map() over list comprehension or vice versa? Is either of them generally more efficient or considered generally more Pythonic than the other?

Answer*

Cancel
2
  • 3
    It's unclear what exact code was run or how large the samples were. Anyway, the big difference between the for-loop and map seems incorrect. Commented Dec 28, 2021 at 14:51
  • The source reference is not sufficiently accurate. Where precisely was it taken from? Please respond by editing (changing) your answer, not here in comments (but ************ without ************ "Edit:", "Update:", or similar - the answer should appear as if it was written today). Commented Jan 16, 2023 at 0:41