[Tutor] lambda vs def

VanL van@lindbergs.org
Tue, 03 Jul 2001 21:36:20 -0600


Hello,

I have been experimenting with functional programming styles using 
python, and I was wondering about speed differences.  How different is

add = lambda x, y: x+y

from

def add(x, y): return x + y ?

Admittedly, this is a trivial example, but for functions called 
repeatedly, it would add up.

Also, how about eval()?  Is the cost for parsing prohibitive?

Thanks,

Van