[Python-Dev] Let's just *keep* lambda
Greg Ewing
greg.ewing at canterbury.ac.nz
Fri Feb 10 05:05:22 CET 2006
Guido van Rossum wrote:
> To those people who believe that lambda is required in some situations
> because it behaves differently with respect to the surrounding scope
> than def: it doesn't, and it never did. This is (still!) a
> surprisingly common myth. I have no idea where it comes from; does
> this difference exist in some other language that has lambda as well
> as some other function definition mechanism?
Not that I know of. Maybe it's because these people first
encountered the concept of a closure in when using lambda in
Lisp or Scheme, and unconsciously assumed there was a
dependency.
> Parting shot: it appears that we're getting more and more
> expressionized versions of statements: ...
> Perhaps we could add a try/except/finally
> expression, and allow assignments in expressions, and then we could
> rid of statements altogether, turning Python into an expression
> language. Change the use of parentheses a bit, and... voila, Lisp! :-)
> <duck>
Or we could go the other way and provide means of writing
all expressions as statements.
call:
foo
x
lambda y,z:
w =:
+:
y
z
print:
"Result is"
w
<counter-duck>
--
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury, | Carpe post meridiam! |
Christchurch, New Zealand | (I'm not a morning person.) |
greg.ewing at canterbury.ac.nz +--------------------------------------+
More information about the Python-Dev
mailing list