Some "pythonic" suggestions for Python

Loic Mahe loic.mahe at nospam.fr
Fri Nov 9 10:54:17 EST 2007


Frank Samuelson a écrit :
> foo = function(x,y) x+y*2   # Example S language code
> bar = foo
> bar(3,4)
> m = lapply( s, foo )
> bb = lapply(s, function(t) t[3]*4 )

Here you want all functions to be lambda functions:

you can get something very close to what you want,
just like this:

foo = lambda x,y: x+y*2
bar = foo
bar(3,4)

you would only need to extend existing lambda:
  * support all python keywords/expressions in lambda
  * multiline lambda
  * multi return value lambda
  * and possibility to map 'function' name to be equivalent to 'lambda'


Loic



More information about the Python-list mailing list