On 12/9/05, David Isaac <[EMAIL PROTECTED]> wrote: > >>> Jibes against the lambda-clingers lead eventually to serious > >>> questions of style in regard to variable namespacing, > >>> lifespan, cleanup, and so on: > >>> > http://groups.google.com/group/comp.lang.python/browse_thread/thread/ad0e15cb6b8f2c32/ > > Alan Isaac <[EMAIL PROTECTED]> wrote: > >> #evaluate polynomial (coefs) at x using Horner's rule > >> def horner(coefs,x): return reduce(lambda a1,a2: a1*x+a2,coefs) > > "Cameron Laird" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > I *think* you're supporting a claim > > about the value of lambda with a specific example. Do I have that > > right? Are you saying that your definition of horner() would suffer > > greatly without lambda? > > It is a simple example of how lambda and reduce can be very expressive. > Anyone who understands Horner's rule can see at a glance that this code > implements it. Anyone who has bothered to learn what lambda and reduce > do can see at a glance what the algorithm is. > > It just cannot get simpler or more expressive. > > Suffer greatly? Surely not. For "suffer greatly" you would probably need > to turn to people who do a lot of event-driven GUI programming. > But suffer, yes. Simplicity and expressiveness are valuable. > That is the point. >
As someone who does a tremendous amount of event-driven GUI programming, I'd like to take a moment to speak out against people using us as a testament to the virtues of lamda. Event handlers are the most important part of event-driven code, and making them real functions with real names is crucial to maintainable code. The only reason to ever use a lamdba in Python is because you don't want to give a function a name, and that is just not a compelling use case for GUI events. > Cheers, > Alan Isaac > > > > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list