Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #42036
| 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 | <jcasale@activenetwerx.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.061 |
| X-Spam-Evidence | '*H*': 0.88; '*S*': 0.00; 'subject:help': 0.08; 'decorator': 0.09; 'methods,': 0.09; 'def': 0.12; 'appreciated!': 0.16; 'args.': 0.16; 'received:172.18.0': 0.16; 'to:name:python- list@python.org': 0.22; 'class': 0.32; 'thanks!': 0.32; 'skip:_ 10': 0.34; 'clear': 0.37; 'to:addr:python-list': 0.38; 'guidance': 0.39; 'to:addr:python.org': 0.39; '8bit%:6': 0.40; 'received:unknown': 0.61; 'making': 0.63; 'within': 0.65; 'hoping': 0.75; 'decorate': 0.84 |
| X-Cloudmark-SP-Filtered | true |
| X-Cloudmark-SP-Result | v=1.1 cv=SNukfclIDc7GjKe+LHtSoPUBJt/gHPuqMk7EpfoOdzs= c=1 sm=1 a=P90J6pEA2ccA:10 a=7PYXob_7ZXMA:10 a=BLceEmwcHowA:10 a=8nJEP1OIZ-IA:10 a=xqWC_Br6kY4A:10 a=oNw28mxuUhXRB3mVwYQ4Ag==:17 a=I1x7mEo_DWEziW7U5iAA:9 a=wPNLvfGTeEIA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 |
| From | "Joseph L. Casale" <jcasale@activenetwerx.com> |
| To | "python-list@python.org" <python-list@python.org> |
| Subject | Decorator help |
| Thread-Topic | Decorator help |
| Thread-Index | AQHOKyIIGDgWeiUVSEqnSm5Oit30Vg== |
| Date | Wed, 27 Mar 2013 19:49:54 +0000 |
| Accept-Language | en-US |
| Content-Language | en-US |
| X-MS-Has-Attach | |
| X-MS-TNEF-Correlator | |
| x-originating-ip | [172.18.0.4] |
| Content-Type | text/plain; charset="iso-8859-1" |
| Content-Transfer-Encoding | quoted-printable |
| MIME-Version | 1.0 |
| 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.3824.1364413867.2939.python-list@python.org> (permalink) |
| Lines | 36 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1364413867 news.xs4all.nl 6901 [2001:888:2000:d::a6]:40087 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:42036 |
Show key headers only | View raw
I have a class which sets up some class vars, then several methods that are passed in data and do work referencing the class vars. I want to decorate these methods, the decorator needs access to the class vars, so I thought about making the decorator its own class and allowing it to accept args. I was hoping to do all the work on in_data from within the decorator, which requires access to several MyClass vars. Not clear on the syntax/usage with this approach here, any guidance would be greatly appreciated! Class MyDecorator(object): def __init__(self, arg1, arg2): self.arg1 = arg1 self.arg2 = arg2 ... Class MyClass(object): def __init__(self): self.var_a = .... .... @MyDecorator(...) def meth_one(self, in_data): ... Thanks! jlc
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Decorator help "Joseph L. Casale" <jcasale@activenetwerx.com> - 2013-03-27 19:49 +0000
Re: Decorator help Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-27 23:29 +0000
Re: Decorator help Jason Swails <jason.swails@gmail.com> - 2013-03-27 22:38 -0400
Re: Decorator help Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-28 04:58 +0000
RE: Decorator help "Joseph L. Casale" <jcasale@activenetwerx.com> - 2013-03-31 00:06 +0000
csiph-web