[Python-ideas] (no subject)

Ivan Levkivskyi levkivskyi at gmail.com
Wed May 6 18:23:25 CEST 2015


I should clarify why I would like to have the possibility to easily compose
functions.
I am a physicist (not a real programmer), and in my code I often compose
functions.

To do this I need to write something like

def new_func(x):
    return f(g(h(x)))

This means I see f(g(h())) quite often and I would prefer to see f @ g @ h
instead.

> > Compared to asynchronous code, I would say function composition is
> > trivial. Anyone who can learn the correspondence
> >
> >     (a @ b)(arg)  <=> a(b(arg))
> >
> > can deal with it.
>
>
> Personally, I can certainly "deal" with it, but it'll never come naturally
> to me. As soon as I see code like this I have to mentally pick it apart
and
> rewrite it in the more familiar form before I understand what's going on.
>
> Maybe if I needed this frequently I'd learn to fly with it, but I just
> don't see the need that often. I see things like f().g() much more often
> than f(g()).
>
> --
> --Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150506/de49dcb2/attachment.html>


More information about the Python-ideas mailing list