[Python-ideas] How do you think about these language extensions?

David Mertz mertz at gnosis.cx
Sat Aug 19 17:13:35 EDT 2017


On Aug 19, 2017 3:44 AM, "Steven D'Aprano" <steve at pearwood.info> wrote:

2) there's that unfortunate call to "compose" which isn't actually part
of the algorithm, its just scaffolding to make it work;


I see this as an ADVANTAGE, actually. We can save the composed function
under another name before applying it to various data later. Or 'rcomposed'
or whatever name.

Moreover, composition is associative.

op1 = compose(a, b, c)
op2 = compose(d, e, f)
op3 = compose(op1, op2)

This is useful for creating compound operations that might be useful in
themselves. The pipe operator doesn't lends itself nearly as well to this
scenario.

FWIW, while I think using a different function name is better, you could
use a 'reversed=True' keyword argument on a compose() function.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170819/3e65faab/attachment.html>


More information about the Python-ideas mailing list