[Python-ideas] Partial operator (and 'third-party methods' and 'piping') [was Re: Function composition (was no subject)]
Rustom Mody
rustompmody at gmail.com
Tue May 12 07:06:31 CEST 2015
On Mon, May 11, 2015 at 8:11 PM, Guido van Rossum <guido at python.org> wrote:
>
>
> As long as I'm "in charge" the chances of this (or anything like it) being
> accepted into Python are zero. I get a headache when I try to understand
> code that uses function composition,
>
I find it piquant to see this comment from the creator of a language that
traces its lineage to Lambert Meertens :-)
[Was reading one of the classics just yesterday
http://www.kestrel.edu/home/people/meertens/publications/papers/Algorithmics.pdf
]
Personally, yeah I dont think python blindly morphing into haskell is a
neat idea
In the specific case of composition my position is...
sqrt(mean(square(x)))
is ugly in a lispy way
(sqrt @ mean @ square)(x)
is backward in one way
(square @ mean @ sqrt)(x)
is backward in another way
sqrt @ mean @ square
is neat for being point-free and reads easy like a Unix '|' but the '@' is
more strikingly ugly
sqrt o mean o square
is a parsing nightmare
square ∘ mean ∘ root
Just right! [Assuming the unicode gods favor its transmission!]
...hopefully not too frivolous to say this but the ugliness of @ overrides
the succinctness of the math for me
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150512/a7b6ddd6/attachment-0001.html>
More information about the Python-ideas
mailing list