Docorator Disected

Ron_Adam radam2 at tampabay.rr.com
Sat Apr 2 11:43:01 EST 2005


On 2 Apr 2005 07:22:39 -0800, "El Pitonero" <pitonero at gmail.com>
wrote:

>Is it possible that you mistakenly believe your @decorator() is being
>executed at the line "func('Hello')"?
>
>Please add a print statement to your code:
>
>def decorator(d_arg):
>     def get_function(function):
>         print 'decorator invoked'
>         def wrapper(f_arg):
>             new_arg = f_arg+'-'+d_arg
>             result = function(new_arg)
>             return result
>         return wrapper
>     return get_function

Thanks, you are correct.  I'll post a revised dissection with print
statements documenting the flow in a few minutes.  I'm still a bit
fuzzy on how the arguments are stored and passed.  

Regards,
Ron_Adam




More information about the Python-list mailing list