Thanks  for the reply.

On 9/21/2013 3:30 PM, bangpypers-requ...@python.org wrote:
Send BangPypers mailing list submissions to
        bangpypers@python.org

To subscribe or unsubscribe via the World Wide Web, visit
        https://mail.python.org/mailman/listinfo/bangpypers
or, via email, send a message with subject or body 'help' to
        bangpypers-requ...@python.org

You can reach the person managing the list at
        bangpypers-ow...@python.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of BangPypers digest..."


Today's Topics:

    1. decorator  help (babmis)
    2. Re: decorator help (Prashant Gaur)
    3. Re: decorator help (Guruprasad)
    4. Re: decorator help (Dhananjay Nene)
    5. Re: September Bangpypers meetup (Baiju M)


----------------------------------------------------------------------

Message: 1
Date: Fri, 20 Sep 2013 18:06:17 +0530
From: babmis <bab...@outlook.com>
To: bangpypers@python.org
Subject: [BangPypers] decorator  help
Message-ID: <blu0-smtp15877371b600dc228bb9dc3ca...@phx.gbl>
Content-Type: text/plain; charset="ISO-8859-1"; format=flowed

I want to print entry and exit message for functions , i have bunch of
such function . How can i do it in decorator.


------------------------------

Message: 2
Date: Fri, 20 Sep 2013 18:18:34 +0530
From: Prashant Gaur <91prashantg...@gmail.com>
To: Bangalore Python Users Group - India <bangpypers@python.org>
Subject: Re: [BangPypers] decorator help
Message-ID:
        <cabewc73apecjkvbo5ph23c5ztgqj-ncct_namayacbbl-ud...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

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


------------------------------

Message: 3
Date: Fri, 20 Sep 2013 18:22:42 +0530
From: Guruprasad <lgp171...@gmail.com>
To: Bangalore Python Users Group - India <bangpypers@python.org>
Subject: Re: [BangPypers] decorator help
Message-ID:
        <CAFZPT6aw_VEH+EjxG_08SrdEYr36-wmJxfAeE=attqo45mu...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

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()
         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


------------------------------

Message: 4
Date: Fri, 20 Sep 2013 19:42:44 +0530
From: Dhananjay Nene <dhananjay.n...@gmail.com>
To: Bangalore Python Users Group - India <bangpypers@python.org>
Subject: Re: [BangPypers] decorator help
Message-ID:
        <CAD2aR4MwtGQYRFi-MT_WmDuYK-vN3K=fjij2n28t60whzqx...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

On Fri, Sep 20, 2013 at 6:06 PM, babmis <bab...@outlook.com> 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("Entering {} with {} {}".format(f.__name__,args,kwargs))
...         ret = f(*args,**kwargs)
...         print("Leaving {} with {}".format(f.__name__, ret))
...         return ret
...     return wrap
...
@trace
... def foo(arg1,arg2,arg3="bar",arg4="buz") :
...     print("Into foo")
...     return ("Zoo", False)
...
foo("hello", "world", arg4="Boo!")
Entering foo with ('hello', 'world') {'arg4': 'Boo!'}
Into foo
Leaving foo with ('Zoo', False)
('Zoo', False)


_______________________________________________
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers

------------------------------

Message: 5
Date: Sat, 21 Sep 2013 12:01:56 +0530
From: Baiju M <baiju.m.m...@gmail.com>
To: Bangalore Python Users Group - India <bangpypers@python.org>
Subject: Re: [BangPypers] September Bangpypers meetup
Message-ID:
        <can8zcbznklqrs_jm_ox+2mm_calbmwa+ycssel0ymjf4jtx...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

BTW, the venue for today's meeting has been finalized and it was
updated in the meetup site:
http://www.meetup.com/BangPypers/events/125800202/

Here is the address:

ZeOmega Infotech Pvt. Ltd.
"Subhashri Pride", 3rd Floor, South End Road,
Basavanagudi, Bangalore-560-004
(Just look for "Axis Bank", it's the same building)

Those who are coming by bus from Majestic/K.R Market look for 15 or
210 buses with extension.
You can get down at "Tata Silk Farm" bus stop.  Our office is just 2
minutes walk-able from the
bus stop.

My mobile number: 9945973441


On Wed, Sep 18, 2013 at 12:20 PM, kracekumar ramaraju
<kracethekingma...@gmail.com> wrote:
Hi All

  We have Bangpypers meetup on september from 3.00 PM to 6.00PM  -
http://www.meetup.com/BangPypers/events/125800202/. Unfortunately myself
and Anand are unavailable.

We don't venue and co-ordinator. We have 96 RSVPS but can expect 20 - 40
people depending on the location. We are looking for organizer and venue.
Anyone up for it?

--
*
Thanks & Regards

"Talk is cheap, show me the code" -- Linus Torvalds
kracekumar
www.kracekumar.com
*
_______________________________________________
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers

------------------------------

Subject: Digest Footer

_______________________________________________
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


------------------------------

End of BangPypers Digest, Vol 73, Issue 64
******************************************



_______________________________________________
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers

Reply via email to