Tom Ritchford
Nov 13, 2023

--

Disagree.

map and filter are both slower and harder to read than list comprehensions and generator functions, which is why Guido wanted to get rid of map, reduce and filter in Python 3.

Which is clearer?

list(map(some_function, nums))

or

[some_function(i) for i in nums]

?

And the advantage is even greater for the second case if you have to create a new function:

list(map((lambda i: some_function(i) + 1), nums))

vs

[some_function(i) + 1 for i in nums]

--

--

No responses yet