When should you use map/filter instead of a list comprehension or generator expression?
When should you use map/filter instead of a list comprehension or generator expression?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You might want to take a look at the responses to this question:
Python List Comprehension Vs. Map
Also, here’s a relevant essay from Guido, creator and BDFL of Python:
http://www.artima.com/weblogs/viewpost.jsp?thread=98196
Personally, I prefer list comprehensions and generator expressions because their meaning is more obvious when reading the code.