Let's Talk About Lambda Functions!

Donn Cave donn at drizzle.com
Thu Aug 15 06:20:20 CEST 2002


Quoth findler_lambda at yahoo.com (Robert Hanlin):
| Tim Peters <tim.one at comcast.net> wrote 
|> I don't think so -- Guido isn't a fan of functional programming styles, and
|> plain doesn't like lambda.  Except, of course, when he uses it, which is
|> always for trivial little function arguments, in accord with his
|> oft-repeated claim that the functional gimmicks were never intended to be
|> more than "minor conveniences" (which he later amended to "minor
|> annoyances", after people started clamoring for more of the same).  
|
| Argh, why not write this in the Tutorial?  A sentence on its own line
| saying that lambda is a minor convenience, and that all the horrors
| commited in its name were not Pythonic.  I wouldn't write in Python
| half as much as I do now if I didn't have functional stuff.  But
| lambda is not important to me, except that when it makes code cleaner,
| it works like a madman.
|
| I don't want everyone putting down the functional community just
| because lambda can be a bit nasty.  I'd be happy if it could somehow
| be nuked from Python, just so functional programming doesn't get such
| bad press for something it didn't do.

Do you think functional programming is harmed by Python's lambda?
It's only a somewhat awkward notation for an anonymous function!
If FP is taking some kind of beating over it, it's the first I've
heard.  It would be like dreading Python because one's introduction
to Haskell made imperative constructs seem difficult.  The quacking
you see about it once in a while on comp.lang.python is fueled more
by a general desire to participate in language development than by
any practical issue.

And as you say, lambda is useful at times.  Supposed to be more
useful with the advent of nested scope, but we'll see - does

   def v():
        n = 'ye nested scope demo'
        f = lambda x: (x, n)
        n = 'something completely different'
        t(f)

work in what you would call an intuitive way?

	Donn Cave, donn at drizzle.com



More information about the Python-list mailing list