Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #29380
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nntp-feed.chiark.greenend.org.uk!ewrotcd!news.nosignal.org!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <prvs=600005506=jeanmichel@sequans.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; '(at': 0.03; '*args,': 0.07; 'decorator': 0.07; '**kwargs)': 0.09; '**kwargs):': 0.09; 'least)': 0.09; 'def': 0.10; 'subject:not': 0.11; ':-/': 0.16; 'docstring': 0.16; 'email addr:functools.wraps(func)': 0.16; 'rsp': 0.16; 'wrote:': 0.17; 'minor': 0.22; 'cc:2**0': 0.23; 'this:': 0.23; 'header:In-Reply-To:1': 0.25; 'email name:': 0.29; 'function': 0.30; '-----': 0.32; 'function.': 0.33; 'to:addr :python-list': 0.33; 'there': 0.35; 'add': 0.36; 'but': 0.36; 'method': 0.36; 'signature': 0.37; 'quite': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'help': 0.40; 'your': 0.60; 'received:194': 0.61; 'loose': 0.84; 'loses': 0.84 |
| X-IronPort-AV | E=Sophos;i="4.80,437,1344204000"; d="scan'208";a="729932" |
| X-Virus-Scanned | amavisd-new at zimbra.sequans.com |
| Date | Mon, 17 Sep 2012 16:20:43 +0200 (CEST) |
| From | Jean-Michel Pichavant <jeanmichel@sequans.com> |
| To | python-list@python.org |
| In-Reply-To | <5B80DD153D7D744689F57F4FB69AF4741667C22E@SCACMX008.exchad.jpmchase.net> |
| Subject | Re: Decorators not worth the effort |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 7bit |
| X-Mailer | Zimbra 7.2.0_GA_2669 (ZimbraWebClient - GC7 (Linux)/7.2.0_GA_2669) |
| 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.834.1347891634.27098.python-list@python.org> (permalink) |
| Lines | 35 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1347891634 news.xs4all.nl 6966 [2001:888:2000:d::a6]:59606 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:29380 |
Show key headers only | View raw
----- Original Message ----- > Jean-Michel Pichavant wrote: [snip] > One minor note, the style of decorator you are using loses the > docstring > (at least) of the original function. I would add the > @functools.wraps(func) > decorator inside your decorator. Is there a way to not loose the function signature as well ? help (t.api.spuAgc) > spuAgc(self, iterations, backoffTarget, step) method of ... But once decorated with this: def stdApi(func): @functools.wraps(func) def inner(self, *args, **kwargs): rsp = func(self, *args, **kwargs) result = TncCmnResult() result.returnCode = self._getReturnCode(rsp) return result return inner help (t.api.spuAgc) > t.api.spuAgc(self, *args, **kwargs) method of .... Quite annoying :-/ JM
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Decorators not worth the effort Jean-Michel Pichavant <jeanmichel@sequans.com> - 2012-09-17 16:20 +0200
csiph-web