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

Stephen Horne intentionally at blank.co.uk
Mon Mar 3 11:45:15 CET 2003


On Mon, 3 Mar 2003 21:17:38 +1100, "Gary Stephenson"
<garys at ihug.com.au> wrote:

>Xbase++ is quite similar to Python in many ways (particularly with 2.2 's
>slots-based classes), and I am puzzled why codeblocks seem so
>extraordinarily useful in Xbase++, and yet lambdas seem almost to languish
>in Python.  Part of the reason may be that Xbase++ doesn't have first-class
>functions, but I can't see that being the whole story.
>
>Is there some fundamental difference between the two that I've failed to
>appreciate?  Or are codeblocks only so popular in Xbase++ because the rest
>of the language is so impoverished in comparison to Python?  Or is the
>codeblock syntax superior enough to make the construct more accessible to
>"lesser minds".

I've not used Clipper since the days when it was a DBase III+
compatible compiler, and I certainly don't recognise code blocks, but
my main comment on the syntax would be that it looks very different
from anything I remember from Clipper - it would stand out in the
code. It would be easy for people who are aware of the syntax to
identify and read the construct and, while there is no keyword, it is
sufficiently different to other syntax that even a reader who is
unaware of them could probably isolate the unknown syntax and look it
up readily enough.

A major problem with 'lambda' is simply that it is an obscure name.
Obscure punctuation is usually less of a problem as long as it is easy
to isolate each construct, and as long as the language does not
overuse it. A clear pattern of symbols can be almost as explicit as a
keyword - it is only when the same symbols get used for many different
purposes that things get severely confusing. However, give something a
fully explicit name, however, and you risk giving it a name that
people hate.

Church calculus is not in most peoples everyday experience, so
'lambda' is a name that a lot of people hate.

Some people hate functional facilities anyway (and I'm far from clear
on relative numbers) as can be seen in the fact that list
comprehensions also sometimes get bashed. List comprehensions actually
have a close relationship with the idea of embedding short imperative
sequences in an expression (though the notation is tweaked along more
functional lines, that is essentially what they do) and they look
superficially rather like the Clipper codeblocks.

-- 
steve at ninereeds dot fsnet dot co dot uk




More information about the Python-list mailing list