Some time ago there was a discussion on IRC, which looked like this:
- You should not use the map() function
in Python but the only list comprehension.
- Why?
- Because it is more Pythonic.
- Why?
- Because all people use the list comprehension.
Other arguments were not convincing as well. I have written about the map
and the list comprehension
in Advanced Python Constructs.
Arguments like “because I say it” or “all people do it like this” (evidence please) are just stupid, not convincing, and simply false (I use map
so that’s not true that all people don't use it
). So I have decided to make some benchmarks for the memory/time characteristics for list comprehensions and maps.