| > But once they start getting complicated - for example nested iteration - they start to look fugly. Then don't do it. Un-nest them always. Simples. > I get access to reduce[1] which is substantially more powerful than map and filter Reduce is orthogonal to map/filter. > Yes, I know that python has map, filter, and reduce. But they're all gimped No they're not: map [x*2 for x in y], [x*2 for x in y if x > 3] (Syntax not tested, am a bit rusty so may be wrong). Okay, you're not providing a function as a parameter but most of the time with map and filter, that parameter is a constant function not a variable so I still hold this is true. Reduce would be nice as a comprehension, if that's possible. > by the way python implements lambdas. Which is sort of necessary due to meaningful whitespace I don't believe whitespace is the problem here. They could fix that pretty easily. I'm really unhappy with python's expression-only lambdas, they do suck. |
Sure, that's an option. It's also an option to only write for loops.
I'd prefer to do neither of those. And I get my way in languages that have ergonomic support for map, reduce, and filter.
> Reduce is orthogonal to map/filter.
Reduce is a superset of map/filter.
> No they're not: map [x2 for x in y], [x2 for x in y if x > 3]
I meant the actual map, filter, and reduce functions that are part of python, not list comprehensions that are, admittedly, a fusion of map and filter.