What is "lambda x=x : ... " ?

Dustan DustanGroups at gmail.com
Fri Jan 11 00:13:44 CET 2008


On Jan 10, 12:36 pm, "zsl... at gmail.com" <levili... at gmail.com> wrote:
> I've figured it out, it is default argument.
> print  y()
> gives 13 as result.
>
> It's a bit evil though.

Why? It's the same syntax as with functions:

x=3
def y(x=x):
    return x+10

print y(2) # prints 12
print y()  # prints 13



More information about the Python-list mailing list