Martin McBride
Apr 26, 2023

--

I agree with most of what you say, the current obsession with clever one-liners in Python is not helpful.

But there is nothing wrong with map. It is a wrapper around a loop, sure, but it is a declarative wrapper. It isn't about making the code shorter, it is about making the code clearer, which just happens to make the code shorter too.

Maybe it takes a bit of getting used to, but map, filter, reduce etc are well known idioms these days that are available in many languages. Even Java now has its own clunky version of function objects and stream processing.

--

--

Martin McBride
Martin McBride

Responses (1)