Would the Python3 version be:
map(merge_func, zip(X,Y))?
map(merge_func, zip(X,Y))?
https://docs.python.org/3/library/itertools.html#itertools.t...
def teeing(reducer1, reducer2):
return lambda acc,elem: (
reducer1(acc[0],elem),
reducer2(acc[1],elem)
)
functools.reduce(
teeing(
(lambda l,elem: [elem] + l),
(lambda l,elem: elem.price + l)
),
cart.getProducts(),
([], 0)
)"Idomatic python" is dead, and lives now only as a pretty dumb ideology which states: everything must be phrased as a naively-typed naively-imperative program. Python is being made, retroactively, a bad imperative programming language: largely because its creator always thought that's what he'd made (he is wrong).
It's a great tragedy "pythonic" has become this: a back-reaction against the times (of increasing adoption of functional programming driven by increasing data-transformation needs).
To me, the features you cite seem to fit the Pythonic approach intuitively.