Tom Ritchford
Sep 1, 2018 · 1 min read

Hate to break it to you — standard practice recommends against using map these days, in favor of list comprehensions and generators, because they’re much easier to read.

I mean, which is clearer:

y = map(lambda i: i + 1, x)

or

y = [i + 1 for i in x]

?

(Also — your iteration variable x is the same as the list you’re iterating over, so your code destroys the list you started with, and is also somewhat confusing…)

    Written by

    uk->at->ca->us->nl

    Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
    Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
    Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade