Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #54472
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'finally:': 0.07; 'exit': 0.09; 'modulo': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'try:': 0.09; 'subject:How': 0.10; 'def': 0.12; 'b):': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'integer': 0.24; 'header:X-Complaints-To:1': 0.27; '"",': 0.31; 'division': 0.31; 'file': 0.32; '(most': 0.33; 'to:addr:python-list': 0.38; 'recent': 0.39; 'subject:can': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'subject:have': 0.80; 'divide': 0.84; 'subject: . ': 0.84; 'subject:want': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Peter Otten <__peter__@web.de> |
| Subject | Re: I want to print entry and exit message for functions , i have bunch of such function . How can i do it in decorator. |
| Date | Fri, 20 Sep 2013 15:23:13 +0200 |
| Organization | None |
| References | <30bf5567-47ff-4b54-acc4-aebb0451e47d@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="ISO-8859-1" |
| Content-Transfer-Encoding | 7Bit |
| X-Gmane-NNTP-Posting-Host | p5084b822.dip0.t-ipconnect.de |
| User-Agent | KNode/4.7.3 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.181.1379683376.18130.python-list@python.org> (permalink) |
| Lines | 36 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1379683376 news.xs4all.nl 16000 [2001:888:2000:d::a6]:49622 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:54472 |
Show key headers only | View raw
bab mis wrote: > def fun: > print "entry" > . > . > print "exit" >>> def log(f): ... def g(*args, **kw): ... print "enter", f.__name__ ... try: ... return f(*args, **kw) ... finally: ... print "exit", f.__name__ ... return g ... >>> @log ... def divide(a, b): ... return a / b ... >>> divide(4, 2) enter divide exit divide 2 >>> divide(4, 0) enter divide exit divide Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 5, in g File "<stdin>", line 3, in divide ZeroDivisionError: integer division or modulo by zero
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
I want to print entry and exit message for functions , i have bunch of such function . How can i do it in decorator. bab mis <babmis307@gmail.com> - 2013-09-20 05:59 -0700
Re: I want to print entry and exit message for functions , i have bunch of such function . How can i do it in decorator. Peter Otten <__peter__@web.de> - 2013-09-20 15:23 +0200
Re: I want to print entry and exit message for functions , i have bunch of such function . How can i do it in decorator. bab mis <babmis307@gmail.com> - 2013-09-22 11:57 -0700
Re: I want to print entry and exit message for functions , i have bunch of such function . How can i do it in decorator. Terry Reedy <tjreedy@udel.edu> - 2013-09-22 16:48 -0400
csiph-web