[Python-ideas] Add 'composable' decorator to functools (with @ matrix multiplication)

Yann Kaiser kaiser.yann at gmail.com
Wed May 6 21:32:54 CEST 2015


On Wed, 6 May 2015 at 09:10 Ivan Levkivskyi <levkivskyi at gmail.com> wrote:

> Dear Guido,
>
> My original idea was to make the composable functions auto-curried
> (similar to proposed here
> http://code.activestate.com/recipes/52902-function-composition/ as
> pointed out by Steve) so that
>
> my_fun = square @ add(1)
> my_fun(x)
>
> evaluates to
>
> square(add(1,x))
>

This breaks the (IMO) fundamental expectation that

    z = add(1)
    my_fun = square @ z

is equivalent to

    my_fun = square @ add(1)

-Yann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150506/8dc1e45e/attachment.html>


More information about the Python-ideas mailing list