Lambda forms and scoping

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sun Mar 22 17:27:59 CET 2009


En Fri, 20 Mar 2009 23:16:00 -0300, alex goretoy
<aleksandr.goretoy at gmail.com> escribió:

> i looks at lambdas as unbound functions(or super function), in the case
> above we create the functions in a list places it in memory unboud, once
> binding a call to the memory address space it returns the value
>
> it is basically same as doing this:
> def f():
>     print "f"
>
> a=f #unbound function, same as rename function
> a() #bind call to address space

Mmm, I don't quite understand what you said. lambda creates functions that
aren't different than functions created by def: apart from the name,
they're really the same thing.

And if you imply that *where* you call a function does matter, it does
not. A function carries its own local namespace, its own closure, and its
global namespace. At call time, no additional "binding" is done (except
parameters -> arguments).

(and the address space is always the one of the running process)

-- 
Gabriel Genellina




More information about the Python-list mailing list