> there's no acceptable way to pass a function body to another in Python. There are sentences which are telling a huge incompetence about the person using these. This sounds the same story to me as "We used tech X, but X is shit/can't do something so we switched to Y, and Y is awesome and fast." Where the person switching was just incompetent with X but it would have been perfectly solvable and they just do a totally…
You can build really complex dynamic async chains in JS very easily because of this. It's hard to explain why it's so nice until you try it.
In JS, I can do something like:
Promise.resolve().then(() => {
let innerPromiseChain = serialOperation1()
.then(serialOperation2);
if (somethingIsTrue) {
// Only inject serialOperation3 at the end of the
// innerPromiseChain if somethingIsTrue
return innerPromiseChain.then(serialOperation3);
}
// else return the inner chain without serialOperation3
return innerPromiseChain;
})
.then((resultOfLastSerialOperation) => { // resultOfLastSerialOperation could be the result of
// either serialOperation2 or serialOperation3 depending
// on the value of somethingIsTrue
// parallelOperation1 and parallelOperation2 will be
// executed in parallel.
return Promise.all(parallelOperation1(), parallelOperation2());
})
.then((parallelOp1Result, parallelOp2Result) => { // This will be called once the previous parallel
// operations have both finished (therefore the
// whole chain has been processed).
});