Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #29490

Re: Decorators not worth the effort

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <prvs=6027b33e1=jeanmichel@sequans.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.015
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; '(at': 0.03; 'decorator': 0.07; 'least)': 0.09; 'cc:addr:python-list': 0.10; 'subject:not': 0.11; 'docstring': 0.16; 'email addr:functools.wraps(func)': 0.16; 'wrote:': 0.17; 'minor': 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'module.': 0.27; 'email name:': 0.29; 'writes:': 0.29; 'function': 0.30; '-----': 0.32; 'function.': 0.33; 'there': 0.35; 'add': 0.36; 'thank': 0.36; 'signature': 0.37; 'subject:: ': 0.38; 'your': 0.60; 'you.': 0.61; 'received:194': 0.61; 'loose': 0.84; 'loses': 0.84
X-IronPort-AV E=Sophos;i="4.80,448,1344204000"; d="scan'208";a="736503"
X-Virus-Scanned amavisd-new at zimbra.sequans.com
Date Wed, 19 Sep 2012 14:47:54 +0200 (CEST)
From Jean-Michel Pichavant <jeanmichel@sequans.com>
To Dieter Maurer <dieter@handshake.de>
In-Reply-To <87txuvxn3b.fsf@handshake.de>
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)
Cc python-list@python.org
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.916.1348058864.27098.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1348058864 news.xs4all.nl 6938 [2001:888:2000:d::a6]:49601
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:29490

Show key headers only | View raw



----- Original Message -----
> Jean-Michel Pichavant <jeanmichel@sequans.com> writes:
> 
> > ----- 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 ?
> 
> Look at the "decorator" module.
> 

Great, thank you.

JM

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Decorators not worth the effort Jean-Michel Pichavant <jeanmichel@sequans.com> - 2012-09-19 14:47 +0200

csiph-web