Naming higher order functions

Achim Domma achim.domma at syynx.de
Thu Jan 31 16:26:46 EST 2002


Hi,

> As to "why" any of these closures work, well, explanation
> depends on your general Python knowledge.  Apart from the
> issue of the free-variable n (thus of nested scopes), is
> the 'working' clear to you?

is the following right:

If I write

def fkt_a(params):
    def fkt_b(xyz):
        do_something

funktion fkt_b is 'recreated' each time the code enters fkt_a ? And 'param'
is a temporary value which would be deleted after the call to fkt_a, but in
this case fkt_b still holds a reference to it ? So each time fkt_a is called
I get a new function fkt_b and each new function fkt_b holds his own
instance of 'params' ?

greetings
Achim






More information about the Python-list mailing list