The part that bothers me about the list comprehension section is that conflating list comprehension and lambda. Is it telling me that list comprehension is better than map/filter or better than lambda? I don't know. Quiet honestly, in many situations I find:
halves_evens = lambda nums : [i/2 for i in nums if nums % 2 == 0]
The part that bothers me about the list comprehension section is that conflating list comprehension and lambda. Is it telling me that list comprehension is better than map/filter or better than lambda? I don't know. Quiet honestly, in many situations I find:
halves_evens = lambda nums : [i/2 for i in nums if nums % 2 == 0]
to be the cleanest.