operator on functions

Szalay Zoltan szz at philoslabs.com
Fri Apr 6 11:33:13 EDT 2001


Hi everybody out there!

It would be a nice feature of Python syntax providing an operator to 
compose a function from another two:
h=f*g  . I mean (f*g)(x)=f(g(x).

It would be useful e.g. in the following situation:
dict={ key1 : func1, key2 : f * g, key3 : func3 }

I know the following gives the same result:
dict={ key1 : func1, key2 : lambda x: f(g(x)), key3 : func3 }

But the former one is more elegant. (IMHO)

Zoltan Szalay
szz at philoslabs.com





More information about the Python-list mailing list