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!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: 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; 'mrab': 0.05; 'callable': 0.09; 'callable.': 0.09; 'decorator': 0.09; 'essentially': 0.11; 'syntax': 0.11; 'wrote:': 0.15; '#call': 0.16; '-tkc': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'message- id:@tim.thechases.com': 0.16; 'received:70.251': 0.16; 'received:dsl.rcsntx.swbell.net': 0.16; 'received:rcsntx.swbell.net': 0.16; 'received:swbell.net': 0.16; 'cc:addr:python-list': 0.16; 'pm,': 0.16; 'cc:2**0': 0.21; 'cc:no real name:2**0': 0.22; 'header:In-Reply-To:1': 0.22; 'function': 0.26; 'pass': 0.28; '"the': 0.29; 'cc:addr:python.org': 0.30; 'if,': 0.30; 'equivalent': 0.31; 'subject:?': 0.31; 'does': 0.32; 'break': 0.33; 'header:User-Agent:1': 0.34; 'defining': 0.35; 'function.': 0.35; "isn't": 0.35; 'totally': 0.35; 'doing': 0.37; 'but': 0.37; 'subject:: ': 0.38; 'two': 0.38; 'should': 0.39; 'results': 0.62; 'john': 0.62; 'subject:this': 0.74; 'link?': 0.84; 'subject:won': 0.84 Date: Sat, 02 Jul 2011 13:45:51 -0500 From: Tim Chase User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11 MIME-Version: 1.0 To: John Salerno Subject: Re: Why won't this decorator work? References: <8b8c3ca2-ae36-4009-842e-1dc90fb01b65@ct4g2000vbb.googlegroups.com> <98cca0c2-8d4f-4313-abed-3f34fa165c6d@u28g2000yqf.googlegroups.com> In-Reply-To: <98cca0c2-8d4f-4313-abed-3f34fa165c6d@u28g2000yqf.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - boston.accountservergroup.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tim.thechases.com X-Source: X-Source-Args: X-Source-Dir: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1309632366 news.xs4all.nl 21808 [2001:888:2000:d::a6]:38488 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:8677 On 07/02/2011 01:08 PM, John Salerno wrote: > On Jul 2, 12:33 pm, MRAB wrote: >> roll_die = move(roll_die) >> >> You should be defining a function (a callable) and then passing it to a >> decorator which returns a callable. > > But why does the documentation say "The return value of the decorator > need not be callable"? I must not be looking at the same documentation you are...could you provide a link? The only time I know of that the return value of a decorator need not be callable is if you want to totally break the syntax of the function. :-/ > And why, if I remove the decorator and just leave the two > functions as if, does the call to move(roll_die()) work? Isn't > that what the decorator syntax is essentially doing? Are you doing move(roll_die()) #call roll_die() and pass results to move() or move(roll_die) # pass the function-object roll_die to move() ? The decorator syntax is the equivalent of roll_die = move(roll_die) -tkc