
Stephen J. Turnbull wrote:
But you didn't, really.
Yes I did, really. Compare (in fixed-width font): ( [x source [1,2,3].iter() for x in [1,2,3] increment .map(lambda x: x+1) for x in [x + 1] if even .filter(lambda x: x % 2 == 0) if x % 2 == 0] .to_list() ) Same source and two transformations, executed in the same order, written in the same order. Steven executes the increment before the filter, keeps odds instead of evens, and wrote the increment even before the source. You do have the same steps (increment and keep evens) as the original and execute them in the same order, but you *wrote* the first transformation *before* the source, nested instead of flat, which reads inside-out in zig-zag fashion. Not that bad with so few transformations, but if we want to do a few more, it'll likely get messy. While the OP's and mine will still read straight from top to bottom.