[BangPypers] BangPypers Digest, Vol 73, Issue 64

babmis babmis at outlook.com
Sun Sep 22 17:32:38 CEST 2013


Thanks  for the reply.


On 9/21/2013 3:30 PM, bangpypers-request at python.org wrote:
> Send BangPypers mailing list submissions to
> 	bangpypers at 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-request at python.org
>
> You can reach the person managing the list at
> 	bangpypers-owner at 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 <babmis at outlook.com>
> To: bangpypers at python.org
> Subject: [BangPypers] decorator  help
> Message-ID: <BLU0-SMTP15877371B600DC228BB9DC3CA220 at 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 <91prashantgaur at gmail.com>
> To: Bangalore Python Users Group - India <bangpypers at python.org>
> Subject: Re: [BangPypers] decorator help
> Message-ID:
> 	<CABewc73apecjkVBo5PH23C5ZtgQj-nCCt_nAmAyacbBL-ud1BA at 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 <lgp171188 at gmail.com>
> To: Bangalore Python Users Group - India <bangpypers at python.org>
> Subject: Re: [BangPypers] decorator help
> Message-ID:
> 	<CAFZPT6aw_VEH+EjxG_08SrdEYr36-wmJxfAeE=ATtQo45muR2A at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> 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
>
>
> ------------------------------
>
> Message: 4
> Date: Fri, 20 Sep 2013 19:42:44 +0530
> From: Dhananjay Nene <dhananjay.nene at gmail.com>
> To: Bangalore Python Users Group - India <bangpypers at python.org>
> Subject: Re: [BangPypers] decorator help
> Message-ID:
> 	<CAD2aR4MwtGQYRFi-MT_WmDuYK-vN3K=FjiJ2N28t60WhzqxxvQ at mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
>
> On Fri, Sep 20, 2013 at 6:06 PM, babmis <babmis at 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 at 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.mail at gmail.com>
> To: Bangalore Python Users Group - India <bangpypers at python.org>
> Subject: Re: [BangPypers] September Bangpypers meetup
> Message-ID:
> 	<CAN8ZCbznkLQRS_jm_Ox+2mm_caLBMWA+YCSseL0YMJF4jtxFHA at 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
> <kracethekingmaker at 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 at python.org
>> https://mail.python.org/mailman/listinfo/bangpypers
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> https://mail.python.org/mailman/listinfo/bangpypers
>
>
> ------------------------------
>
> End of BangPypers Digest, Vol 73, Issue 64
> ******************************************
>
>



More information about the BangPypers mailing list