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

Chris Angelico rosuav at gmail.com
Wed May 6 18:15:58 CEST 2015


On Thu, May 7, 2015 at 2:10 AM, 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))

Hmm. This would require that your composable functions autocurry,
which may be tricky to do in the general case. It also requires that
the right hand function be composable, unlike in your earlier example.

ChrisA


More information about the Python-ideas mailing list