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


Groups > comp.lang.python > #7835

Re: How to avoid "()" when writing a decorator accepting optional arguments?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeder.news-service.com!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ethan@stoneleaf.us>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:when': 0.07; 'callable': 0.09; 'decorator': 0.09; 'deprecated': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; 'received:gator410.hostgator.com': 0.09; '~ethan~': 0.09; 'written': 0.14; 'wrote:': 0.14; '(optionally)': 0.16; 'deprecate': 0.16; 'received:72.11': 0.16; 'received:72.11.125': 0.16; 'received:72.11.125.166': 0.16; 'subject: \n ': 0.16; 'subject:writing': 0.16; 'cc:addr:python-list': 0.17; 'header:In- Reply-To:1': 0.21; 'say,': 0.22; 'cc:2**0': 0.22; 'cc:no real name:2**0': 0.23; 'function': 0.25; 'subject:?': 0.29; '"you': 0.29; 'subject:How': 0.30; 'cc:addr:python.org': 0.30; 'calling': 0.31; "i've": 0.33; 'example,': 0.35; 'header:User-Agent:1': 0.35; 'replacement': 0.35; 'bother': 0.37; 'subject:: ': 0.38; 'your': 0.60; 'providing': 0.61; 'received:websitewelcome.com': 0.67; 'to:charset:iso-8859-1': 0.82; 'received:64.5': 0.84
Date Fri, 17 Jun 2011 10:18:07 -0700
From Ethan Furman <ethan@stoneleaf.us>
User-Agent Thunderbird 1.5.0.10 (Windows/20070221)
MIME-Version 1.0
To Giampaolo RodolĂ  <g.rodola@gmail.com>
Subject Re: How to avoid "()" when writing a decorator accepting optional arguments?
References <BANLkTi=WtyyPMEv+BN-CW4+qB686-05Sew@mail.gmail.com>
In-Reply-To <BANLkTi=WtyyPMEv+BN-CW4+qB686-05Sew@mail.gmail.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 8bit
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - gator410.hostgator.com
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - stoneleaf.us
X-BWhitelist no
X-Source
X-Source-Args
X-Source-Dir
X-Source-Sender mail.admailinc.com ([192.168.10.136]) [72.11.125.166]:4203
X-Source-Auth ethan+stoneleaf.us
X-Email-Count 1
X-Source-Cap dG9idWs7dG9idWs7Z2F0b3I0MTAuaG9zdGdhdG9yLmNvbQ==
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
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.81.1308330272.1164.python-list@python.org> (permalink)
Lines 12
NNTP-Posting-Host 82.94.164.166
X-Trace 1308330272 news.xs4all.nl 49177 [::ffff:82.94.164.166]:50151
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:7835

Show key headers only | View raw


Giampaolo RodolĂ  wrote:
> I've written this decorator to deprecate a function and (optionally)
> provide a callable as replacement

I can see providing the replacement function so that you can say, for 
example, "you are calling a deprecated function -- <function xyz> is the 
replacement".

If your replacement function is drop-in compatible, though, why bother 
with the whole deprecate decorator?  Just drop it in!  :)

~Ethan~

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


Thread

Re: How to avoid "()" when writing a decorator accepting optional arguments? Ethan Furman <ethan@stoneleaf.us> - 2011-06-17 10:18 -0700

csiph-web