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


Groups > comp.lang.python > #29442

Re: Decorators not worth the effort

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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; '(at': 0.03; 'decorator': 0.07; 'least)': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:not': 0.11; 'docstring': 0.16; 'email addr:functools.wraps(func)': 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.17; 'minor': 0.22; 'header:User-Agent:1': 0.26; 'module.': 0.27; 'header:X-Complaints-To:1': 0.28; 'email name:': 0.29; 'writes:': 0.29; 'function': 0.30; '-----': 0.32; 'function.': 0.33; 'to:addr:python-list': 0.33; 'there': 0.35; 'add': 0.36; 'received:org': 0.36; 'charset:us-ascii': 0.36; 'signature': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'your': 0.60; 'received:217': 0.68; 'loose': 0.84; 'loses': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Dieter Maurer <dieter@handshake.de>
Subject Re: Decorators not worth the effort
Date Tue, 18 Sep 2012 19:22:32 +0200
References <5B80DD153D7D744689F57F4FB69AF4741667C22E@SCACMX008.exchad.jpmchase.net> <246757766.1607257.1347891643781.JavaMail.root@sequans.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Gmane-NNTP-Posting-Host pd9e091cd.dip0.t-ipconnect.de
User-Agent Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux)
Cancel-Lock sha1:QTK36vVYTRKJRiwqfiMhZ8N7uR4=
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.885.1347988968.27098.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1347988968 news.xs4all.nl 6847 [2001:888:2000:d::a6]:35419
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:29442

Show key headers only | View raw


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.

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


Thread

Re: Decorators not worth the effort Dieter Maurer <dieter@handshake.de> - 2012-09-18 19:22 +0200

csiph-web