Decorator Dissection
Ron_Adam
radam2 at tampabay.rr.com
Sat Apr 2 15:36:50 EST 2005
On Sat, 02 Apr 2005 18:39:41 GMT, Ron_Adam <radam2 at tampabay.rr.com>
wrote:
>>def foo():
>> a = 10
>> def bar():
>> return a*a
>> return bar
>>
>>print foo()() <--------------- *Here*
>>
>>
>>No decorator-specific magic here - just references kept to outer frames
>>which form the scope for the inner function.
Thanks Kay, I wasn't aware of pythons ability to pass arguments to
nested functions in this way. I missed it the first time.
Cheers,
Ron
More information about the Python-list
mailing list