[Python-ideas] How do you think about these language extensions?
Steven D'Aprano
steve at pearwood.info
Sat Aug 19 20:45:11 EDT 2017
On Sat, Aug 19, 2017 at 09:05:36AM -0700, David Mertz wrote:
> You are right, of course. Mine does the order wrong. But an 'rcompose()' or
> 'pipe()' or 'funchain()' is easy enough to put in the right order.
Indeed.
I said earlier that your solution (corrected for its error) was a pretty
neat solution, and it was mostly down to a sense of aethetics which we
might prefer. I think a pipe or arror is aethetically nicer, and speaks
much more closely to the intent.
Analogy:
We don't need operators + - * / etc, since it's trivial to get the same
effect using the functions in the operator module. But operators look
nicer and are closer to the way people think of arithmetic.
I think that function composition is a neat and powerful tool for those
who already think functionally, but higher order functions are harder to
teach and even experts can mess them up.
(The lesson here is that the pipe operator | is like a postfix
version of the composition operator ∘ .)
--
Steve
More information about the Python-ideas
mailing list