"Xavier Décoret" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I cannot find the way to do generic lambda functions using the lambda
> syntax in python. I am probably missing a point.
Thinking of lambda args: expression
as more or less abbreviati
def PRINT(x): print x
f = lambda: PRINT("hello")
###
def let(x,y):
globals()[x] = y
return True
f = lambda x: let('y',x*x) and y+y
--
http://mail.python.org/mailman/listinfo/python-list
hello,
On Fri, 24 Jun 2005 14:48:16 +0200, Xavier Décoret wrote:
> Hi,
>
> In the same spirit, how can I do to compute intermediary values in the
>
> body of a lambda function. Let's say (dummy example):
>
> f = lambda x : y=x*x,y+y
>
>
> In languages like Caml, you can do:
>
> let f = func
"Xavier Décoret" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I cannot find the way to do generic lambda functions using the lambda
> syntax in python. I am probably missing a point.
You are. Lambda is restricted to a _single expression_.
Your first example is a stateme
Xavier Décoret wrote:
> Is there a particular syntax for lambda that I am missing
> or is it simply limited and I cannot do what I want with lambda.
Lambda is deliberately limited. Just define a function.
The only downside to defining a function is that you have to think of a
name for it, but
On 6/24/05, Xavier Décoret <[EMAIL PROTECTED]> wrote:
>
> For example, the code
>
> # f = lambda : print "hello"
> # f()
> does not compile, although:
>
> # def f():
> # print "hello"
> # f()
>
> does compile. Is there a particular syntax for lambda that I am missing
> or is it simply lim
Hi,
I cannot find the way to do generic lambda functions using the lambda
syntax in python. I am probably missing a point.
For example, the code
# f = lambda : print "hello"
# f()
does not compile, although:
# def f():
# print "hello"
# f()
does compile. Is there a particular syntax fo