Something is rotten in Denmark...

Gregory Ewing greg.ewing at canterbury.ac.nz
Thu Jun 2 19:43:54 EDT 2011


Alain Ketterlin wrote:
> But going against generally accepted semantics should at least
> be clearly indicated. Lambda is one of the oldest computing abstraction,
> and they are at the core of any functional programming language.

Yes, and Python's lambdas behave exactly the *same* way as
every other language's lambdas in this area. Changing it to
do early binding would be "going against generally accepted
semantics".

It's not the lambda that's different from other languages,
it's the for-loop. In languages that encourage a functional
style of programming, the moral equivalent of a for-loop is
usually some construct that results in a new binding of the
control variable each time round, so the problem doesn't
arise very often.

If anything should be changed here, it's the for-loop, not
lambda.

-- 
Greg



More information about the Python-list mailing list