PEP 312 - Making lambdas implicit worries me, surely it's just the name 'lambda' that is bad...

Dan Schmidt dfan at dfan.org
Mon Mar 3 11:03:30 EST 2003


Jack Diederich <jack at performancedrivers.com> writes:

| My major problem with 'lambda' is just the way it jars the eye when
| reading code.  Even with a colorizing editor the fact that it is a
| word and a longish one at that adds to the cost of both writing and
| reading map(), filter(), etc.  'lambda' is the only long keyword to
| always appear in the middle of a line[2].
|
| I know how the folks who want a ternary operator - ANY ternary
| operator - feel, I'd take almost any way to make lambdas look nicer.
| I've even considered recompiling my local Grammar with 'L' replacing
| 'lambda'.

I am a big fan of functional programming and I never use lambdas in my
Python code because they're too ugly looking.  (It's different in Lisp,
where all the syntax looks the same, but even there I think lambda is
too verbose - and so does Lisp guru Paul Graham, who's renamed lambda
to fn in his new Lisp dialect Arc.)  I'd complain more loudly, but I
think Guido likes the fact that their ugliness dissuades people from
using them...

Luckily, in at least half of the places that I would want to use
anonymous functions I can now use list comprehensions, which are quite
pretty and clear.

Dan

-- 
http://www.dfan.org




More information about the Python-list mailing list