Extending Python Syntax with @
David MacQuigg
dmq at gain.com
Thu Mar 11 03:42:00 EST 2004
On Thu, 11 Mar 2004 05:13:25 -0000, claird at lairds.com (Cameron Laird)
wrote:
>Pierre Rouleau <prouleau at impathnetworks.com> wrote: .
>>I was trained as an EE myself and started programming in assembler on
>>microprocessors, then in C , then in C++, reading, reading, reading,....
>>Just the mere fact that you are talking about lambda shows that you know
>>what it is, as I do now and as people learning Python will know when
>>they use it. They'll learn, that why they are technical professionals, no?
I agree. Lamdas are no big deal once you get past some obfuscation
and understand they perform a very simple function. Of course, both
of us could be missing something important. There is a lot of deep
theory behind the lambda calculus. While drawing a tentative
conclusion, we have to always keep an open mind to something new.
On Thu, 11 Mar 2004 05:13:25 -0000, claird at lairds.com (Cameron Laird)
wrote:
> For more on what lambda means to me, and others, see
> <URL: http://www.csse.monash.edu.au/~lloyd/tildeFP/Lambda/Ch/00.Intro.html >
> or
> <URL: http://www.mactech.com/articles/mactech/Vol.07/07.05/LambdaCalculus/ >
> or
> <URL: http://www.alcyone.com/software/church/ > or ...
This is an impressive body of knowledge, but unless I see how it is
going to help me write some code, I won't have time to study it. My
understanding of lambda functions is simply that they are a way to
squeeze functions into a tight space:
list_of_funcs = [(lambda x: 2**x), (lambda x: 3**x), (lambda x: 4**x)]
If you are not concerned about space, simply use normal defs:
def f2(x): return 2**x
def f3(x): return 3**x
def f4(x): return 4**x
list_of_funcs = [f2, f3, f4]
Is there any other reason in Python to use lambdas?
-- Dave
More information about the Python-list
mailing list