4 ms·
Obviously, map and filter are better because ... ah, hmm, I don't know. I think it is a matter of language design. Higher order functions are not as prominent
by maxtilford 17y ago
Obviously, map and filter are better because ... ah, hmm, I don't know.
I think it is a matter of language design. Higher order functions are not as prominent in Python as say, Haskell, where map & friends are generally preferred for composability.
Lispers prefer map & friends just because list comprehensions add all that messy syntax.
If I were a Python programmer, I would probably use list comprehensions, since they seem to be the preferred idiom.