A critic of Guido's blog on Python's lambda

Thomas F. Burdick tfb at conquest.OCF.Berkeley.EDU
Sat May 6 10:22:41 CEST 2006


Ken Tilton <kentilton at gmail.com> writes:

> <g> Hopefully it can be a big issue and still not justify a flame war.
> 
> Mileages will always vary, but one reason for lambda is precisely not
> to have to stop, go make a new function for this one very specific
> use, come back and use it as the one lambda statement, or in C have an
> address to pass. but, hey, what are editors for? :)
> 
> the bigger issue is the ability of a lambda to close over arbitrary
> lexically visible variables. this is something the separate function
> cannot see, so one has to have a function parameter for everything.
> 
> but is such lexical scoping even on the table when Ptyhon's lambda
> comes up for periodic review?

This is second-hand, as I don't actually follow Python closely, but
from what I've heard, they now have reasonable scoping rules (or maybe
they're about to, I'm not sure).  And you can use def as a
Scheme-style inner define, so it's essentially a LABELS that gets the
indentation wrong.  This means they have proper closures, just not
anonymous ones.  And an egregiously misnamed lambda that should be
fixed or thrown out.

If Python gets proper macros it won't matter one bit that they only
have named closures, since you can macro that away in a blink of an
eye.



More information about the Python-list mailing list