Re: [BangPypers] decorator help

2013-09-20 Thread Dhananjay Nene
On Fri, Sep 20, 2013 at 6:06 PM, babmis wrote: > I want to print entry and exit message for functions , i have bunch of such > function . How can i do it in decorator. >>> from functools import wraps >>> >>> def trace(f): ... @wraps(f) ... def wrap(*args, **kwargs): ... print("Ent

Re: [BangPypers] decorator help

2013-09-20 Thread Guruprasad
Hi babmis, On Fri, Sep 20, 2013 at 6:18 PM, Prashant Gaur <91prashantg...@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() >

Re: [BangPypers] decorator help

2013-09-20 Thread Prashant Gaur
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__ logging

[BangPypers] decorator help

2013-09-20 Thread babmis
I want to print entry and exit message for functions , i have bunch of such function . How can i do it in decorator. ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers