Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #36853
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin1!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <contropinion@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.013 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'received:209.85.223': 0.03; 'called.': 0.09; 'def': 0.10; 'to:name:python-list': 0.15; 'output?': 0.16; '>>>': 0.18; '>>>': 0.22; 'message- id:@mail.gmail.com': 0.27; 'lines': 0.28; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'received:209.85': 0.35; 'there': 0.35; 'two': 0.37; 'why': 0.37; 'received:209': 0.37; 'to:addr:python.org': 0.39 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=er2COUgaGGIF+13F+dYTohBoUgRj2naO9IrE44Igu7k=; b=CUkk1EEMCR1nJ0BDmSplwmFBcOGdoSzv2bfbp1nX7jtrsmS9Tj3PpgmiEu1+zJUK+o UYkU2H9pD9CatCtRTT143gZB9HromgMcw7jdeGlcBsWBenTxxh7T9K03VlPV8xV/HmZx SHDSfR6AfQpXQK70EQEoZym62GLOW8Q3ZQ3sALaTN86+HtiRXW/+F9MQnxa/vFUffIVL ycA0g9jWCQgvl13NktPm+9atVZvSp1f931blDLlkYFiXNMfE30Bd2CTZrB5t1290PoO6 bD3AReqlz6Qzr076IswOncvGOsJxY3dVKQDBnFLfKJOZAzcIRmKYYVF4NW4u2/lWxrCQ RnIA== |
| MIME-Version | 1.0 |
| X-Received | by 10.50.158.165 with SMTP id wv5mr1810721igb.3.1358259604515; Tue, 15 Jan 2013 06:20:04 -0800 (PST) |
| Date | Tue, 15 Jan 2013 22:20:04 +0800 |
| Subject | i can't understand decorator |
| From | contro opinion <contropinion@gmail.com> |
| To | python-list <python-list@python.org> |
| Content-Type | multipart/alternative; boundary=14dae934062f3d6a2304d3547532 |
| 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 | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.537.1358259607.2939.python-list@python.org> (permalink) |
| Lines | 57 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1358259607 news.xs4all.nl 6848 [2001:888:2000:d::a6]:52648 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:36853 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
>>> def deco(func):
... def kdeco():
... print("before myfunc() called.")
... func()
... print(" after myfunc() called.")
... return kdeco
...
>>> @deco
... def myfunc():
... print(" myfunc() called.")
...
>>> myfunc()
before myfunc() called.
myfunc() called.
after myfunc() called.
>>> deco(myfunc)()
before myfunc() called.
before myfunc() called.
myfunc() called.
after myfunc() called.
after myfunc() called.
1.
why there are two lines :before myfunc() called.and tow lines :after
myfunc() called. in the output?
2.why the result is not
before myfunc() called.
myfunc() called.
after myfunc() called.
before myfunc() called.
myfunc() called.
after myfunc() called.
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
i can't understand decorator contro opinion <contropinion@gmail.com> - 2013-01-15 22:20 +0800 Re: i can't understand decorator Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2013-01-15 22:21 +0100
csiph-web