In the Python Tutorial, it says:

Why? I don’t see how comprehensions are “more flexible”. It seems to me to be only a difference in syntax. I can easily do:
def my_round(i):
return str(round(355/113.0, i))
a = map(my_round, range(1, 6))
I don’t see how map() lacks flexibility here.
Can anyone elaborate?
The difference is relatively small, but you have to write a fully-fledged
defincluding name or alambdato use nontrivial expressions withmap, while you can just go and use them in a list comprehension. Also, list comprehensions include filtering while you’d need a seperatefiltercall for that (inefficient and the parens quickly grow beyond what can be managed easily).