Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!ecngs!feeder2.ecngs.de!novso.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'tests.': 0.07; 'mess': 0.09; 'messing': 0.09; 'subject:skip:c 10': 0.09; 'def': 0.12; '-tkc': 0.16; 'consolidate': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'lambda': 0.16; 'preexisting': 0.16; 'decorators': 0.24; 'passes': 0.24; 'fine': 0.24; "i've": 0.25; 'pass': 0.26; 'yields': 0.31; 'quite': 0.32; 'could': 0.34; 'something': 0.35; 'sequence': 0.36; 'charset:us-ascii': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'results.': 0.60; 'different': 0.65; 'around,': 0.84; 'received:50.22': 0.84 Date: Tue, 29 Oct 2013 11:54:27 -0500 From: Tim Chase To: python-list@python.org Subject: stacked decorators and consolidating X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII 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-Get-Message-Sender-Via: boston.accountservergroup.com: authenticated_id: tim@thechases.com X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 33 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1383065569 news.xs4all.nl 16003 [2001:888:2000:d::a6]:44120 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:57933 I've got some decorators that work fine as such: @dec1(args1) @dec2(args2) @dec3(args3) def myfun(...): pass However, I used that sequence quite a bit, so I figured I could do something like dec_all = dec1(args1)(dec2(args2)(dec3(args3))) to consolidate the whole mess down to @dec_all def myfun(...): pass However, this yields different (test-breaking) results. Messing around, I found that if I write it as dec_all = lambda fn: dec1(args1)(dec2(args2)(dec3(args3)(fn))) it works and passes all preexisting tests. What am I missing that would cause this difference in behavior? -tkc