explain this function to me, lambda confusion

globalrev skanemupp at yahoo.se
Wed May 7 17:49:24 EDT 2008


On 7 Maj, 23:47, globalrev <skanem... at yahoo.se> wrote:
> and what si the diffrence here:
>
> g = lambda x=5:x*x
> g = lambda x:x*x
>
> the first was a mistake to write but it worked
> and the x=5 seems to be completely ignored. why? it has no effect at
> all?

ah wait now i see it has a default kind of then. g() returns 25 while
g(8) returns 64.



More information about the Python-list mailing list