Is there a reason to prefer using map()
over list comprehension or vice versa? Is either of them generally more efficient or considered generally more pythonic
I find list comprehensions are generally more expressive of what I'm trying to do than map
- they both get it done, but the former saves the mental load of trying to understand what could be a complex lambda
expression.
There's also an interview out there somewhere (I can't find it offhand) where Guido lists lambda
s and the functional functions as the thing he most regrets about accepting into Python, so you could make the argument that they're un-Pythonic by virtue of that.