Python feature request : operator for function composition
George Sakkis
george.sakkis at gmail.com
Sun Feb 3 17:34:54 EST 2008
On Feb 3, 12:09 am, Kay Schluehr <kay.schlu... at gmx.net> wrote:
> As you know, there is no operator for function composition in Python.
> When you have two functions F and G and want to express the
> composition F o G you have to create a new closure
>
> lambda *args, **kwd: F (G (*args, **kwd))
>
> or you write a composition in functional style
>
> compose( F, G )
>
> None of these solutions is particular terse.
What if F takes more than one (positional and/or keyword) arguments?
How common is this special use case where F takes a single argument
(the result of G) to deserve a special operator ?
George
More information about the Python-list
mailing list