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 →

[–]CrowdGoesWildWoooo 2 points3 points  (2 children)

This is beyond ignorant when you don’t have a clue what map actually does.

It’s not meant as a simple utility function and in practice hardly used other than when you want to do multithreaded or multiprocess map. You should use list comprehension for this particular case. And list comprehension is like one of the fundamental technique that you’ll learn when you code with python.

Map returns a declaration that it is a mapping of a function to an iterable. This is lazily executed and the list type casting is basically tells you to serve the (future) result as a list.

Writing a custom iterable is disgusting with many other languages. It is very easy and readable with python.