Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #56644
| Path | csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <cameron@cskk.homeip.net> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'nasty': 0.07; 'cc:addr :python-list': 0.11; 'def': 0.12; 'anyway': 0.14; '"""return': 0.16; 'finney': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'function?': 0.16; 'magic': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'portable': 0.16; 'received:211.29': 0.16; 'received:211.29.132': 0.16; 'received:cskk.homeip.net': 0.16; 'received:homeip.net': 0.16; 'received:optusnet.com.au': 0.16; 'received:syd.optusnet.com.au': 0.16; 'simpson': 0.16; 'squirrel': 0.16; 'stdlib.': 0.16; 'wrote:': 0.18; 'skip:f 30': 0.19; 'stack': 0.19; 'not,': 0.20; 'cc:addr:python.org': 0.22; 'header:User- Agent:1': 0.23; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'appear': 0.29; 'getting': 0.31; "d'aprano": 0.31; 'fine,': 0.31; 'steven': 0.31; 'writes:': 0.31; 'level.': 0.33; 'not.': 0.33; "i'd": 0.34; 'but': 0.35; 'there': 0.35; 'limitations': 0.36; 'received:com.au': 0.36; 'useful': 0.36; 'charset:us-ascii': 0.36; 'so,': 0.37; 'skip:o 20': 0.38; 'ben': 0.38; 'received:211': 0.38; 'little': 0.38; 'either': 0.39; 'skip:u 10': 0.60; 'course.': 0.60; 'black': 0.61; 'content-disposition:inline': 0.62; 'yes': 0.68; 'not:': 0.91; 'walking': 0.91; 'whereas': 0.91; 'technique': 0.93 |
| Date | Fri, 11 Oct 2013 15:36:29 +1100 |
| From | Cameron Simpson <cs@zip.com.au> |
| To | Ben Finney <ben+python@benfinney.id.au> |
| Subject | Re: Skipping decorators in unit tests |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| In-Reply-To | <7w1u3so4lv.fsf@benfinney.id.au> |
| User-Agent | Mutt/1.5.21 (2010-09-15) |
| References | <7w1u3so4lv.fsf@benfinney.id.au> |
| X-Optus-CM-Score | 0 |
| X-Optus-CM-Analysis | v=2.1 cv=YYGEuWhf c=1 sm=1 tr=0 a=YuQlxtEQCowy2cfE5kc7TA==:117 a=YuQlxtEQCowy2cfE5kc7TA==:17 a=ZtCCktOnAAAA:8 a=PO7r1zJSAAAA:8 a=LcaDllckn3IA:10 a=MIEZmskQDU0A:10 a=kj9zAlcOel0A:10 a=vrnE16BAAAAA:8 a=AS59is4VRK8A:10 a=kZ7UWmmPAAAA:8 a=Muj0lNfy1ZwDQPwsnFEA:9 a=CjuIK1q_8ugA:10 a=pyH5b1fOeEsA:10 |
| 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 | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.983.1381466200.18130.python-list@python.org> (permalink) |
| Lines | 30 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1381466200 news.xs4all.nl 15871 [2001:888:2000:d::a6]:55380 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:56644 |
Show key headers only | View raw
On 11Oct2013 14:42, Ben Finney <ben+python@benfinney.id.au> wrote: > Cameron Simpson <cs@zip.com.au> writes: > > On 11Oct2013 02:55, Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote: > > > def undecorate(f): > > > """Return the undecorated inner function from function f.""" > > > return f.func_closure[0].cell_contents > > > > Whereas this feels like black magic. Is this portable to any decorated > > function? If so, I'd have hoped it was in the stdlib. If not: black > > magic. > > What would you expect? The purpose of decorating functions is to do > magic to make it appear as though the original function isn't there any > more. Any technique to getting at that original function anyway is *of > course* going to look like black magic at the implementation level. Sigh. Yes of course. It is no uglier than walking a frame stack etc. But is it reliable? Will it work on any decorated function? If so, fine, and I'd be happy to squirrel it away as a useful standard incantation for something. If not, then it's nasty only-mostly-reliable magic and I either want little to do with it, OR I want to know its specific limitations so I know when to use it and when not. -- Cameron Simpson <cs@zip.com.au> But pessimism IS realism! - D.L.Bahr
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: Skipping decorators in unit tests Cameron Simpson <cs@zip.com.au> - 2013-10-11 15:36 +1100
Re: Skipping decorators in unit tests Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-10-11 05:51 +0000
Re: Skipping decorators in unit tests Cameron Simpson <cs@zip.com.au> - 2013-10-11 17:40 +1100
csiph-web