5 ms·
Python list comprehensions _are_ map/reduce.
by pxndx 8y ago
Python list comprehensions _are_ map/reduce.
- mehrdadn 8y agoI think you mean map/filter.
- pxndx 8y agoYes, thanks for correcting me.
- yxhuvud 8y agoSure, but they compose really bad.
- vanderZwan 8y agoWhy? Just assign to a variable, then do another list comprehension on the next line, no?
- yxhuvud 8y agoAnd that is a pretty sad state of affairs compared to ways that do compose well, like the one in Ruby which you can easily chain.