K
Kay Schluehr
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.
Proposal
-------------
I want to propose overloading the logical __and__ operator i.e. '&'
for functions s.t. F & G means "compose(F,G)". This suggestion is non-
conflicting since & is not used as an operator in combination with
function objects yet: given a function object F and an arbitrary
object X the combination F & X raises a TypeError when evaluated.
Alternatives
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.
Proposal
-------------
I want to propose overloading the logical __and__ operator i.e. '&'
for functions s.t. F & G means "compose(F,G)". This suggestion is non-
conflicting since & is not used as an operator in combination with
function objects yet: given a function object F and an arbitrary
object X the combination F & X raises a TypeError when evaluated.
Alternatives