Docorator Disected

Diez B. Roggisch deetsNOSPAM at web.de
Sat Apr 2 12:59:30 EST 2005


> statements documenting the flow in a few minutes.  I'm still a bit
> fuzzy on how the arguments are stored and passed.

The arguments are part of the outer scope of the function returned, and thus
they ar kept around. That's standart python,too:

def foo():
    a = 10
    def bar():
       return a*a
    return bar

print foo()()


No decorator-specific magic here - just references kept to outer frames
which form the scope for the inner function.

-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list