Securing a future for anonymous functions in Python
alan.gauld at btinternet.com
Fri Jan 7 19:36:43 EST 2005
On Fri, 07 Jan 2005 08:44:57 -0700, Steven Bethard
<steven.bethard at gmail.com> wrote:
> > The unfamiliar argument doesn't work for me. After all most
> > people are unfamiliar with complex numbers (or imaginary) numbers
> complex numbers. Lambdas, on the other hand, show up in all kinds of
> code, and even though I hardly ever use them myself, I have to
> understand them because other people do (over-)use them.
That's a fair point I suppose but I still don't see much point in
introducing new names and syntaxes when the existing name is a
sensible one, even if unfamiliar to many. After all it works in
Lisp and Haskell - Haskell even uses Lambda as its emblem...
And besides it may just encoursage some to go and explore Lambda
calculus, it did for me... And my programing improved enormously
as a result. So maybe having the name as a stimulant to research
is a good thing...
OTOH I do accept the point made by another poster that Pythons
single expression limitations mean that they are a poor imitation
of lambdas in other languages. And provided I get some kind of
anonymous code block to pass around I don't care too much if the
name lambda disappears, provided the concept remains! And the
syntax is reasonably simple to use where lambdas get used now.
(Without lambdas of any kind I might finally make the jump
to Ruby that I've been toying with for a while but I just hate
those Perl-like @ symbols...)
We often see people stating that programming shouldn't be called
a science because there is no mathematical basis, such claimants
usually haven't seen Predicate or Lambda calculus. I know, I used
to be in that category and while I don't explicitly use either
when programming (or only rarely) awareness of the principles
suddenly made a lot of the "rules of programming" that I'd been
taught make perfect sense (no side-effects, avoid globals, etc)
Its like the fact that I rarely use Maxwell's equations when
designing electronic circuits - but its nice to
know what the underlying theory is actually based on!
All IMHO of course! :-)
Author of the Learn to Program website
More information about the Python-list