[BangPypers] decorator help
Guruprasad
lgp171188 at gmail.com
Fri Sep 20 14:52:42 CEST 2013
Hi babmis,
On Fri, Sep 20, 2013 at 6:18 PM, Prashant Gaur <91prashantgaur at gmail.com> wrote:
> Hello Babmis ,
>
> Please check below code.
> Let me know if i am wrong.
>
>
> def track(urfunc):
> def loggingfun():
> print "enter " , urfunc.__name__
> outcome = urfunc()
> print "exit ", urfunc.__name__
>
> return outcome
> loggingfun.__name__ = urfunc .__name__
> loggingfun.__doc__ = urfunc .__doc__
> return loggingfun
Before you go ahead and try this code, I would recommend that you read
a bit about decorators in Python. The one that I usually refer to is
this StackOverflow answer - http://stackoverflow.com/a/1594484.
Thanks & Regards,
Guruprasad
More information about the BangPypers
mailing list