Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #15586
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <chris@rebertia.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.026 |
| X-Spam-Evidence | '*H*': 0.95; '*S*': 0.00; 'python': 0.08; 'to:addr:comp.lang.python': 0.09; 'def': 0.14; 'cc:addr:python- list': 0.15; '@property': 0.16; 'foo(object):': 0.16; 'ugly.': 0.16; 'cheers,': 0.18; 'wrote:': 0.18; '>>>': 0.18; 'cc:no real name:2**0': 0.21; 'maybe': 0.21; 'header:In-Reply-To:1': 0.23; 'variable': 0.24; 'cc:2**0': 0.25; 'parameters': 0.25; 'received:209.85.220': 0.27; 'separate': 0.28; 'pass': 0.28; 'cc:addr:python.org': 0.29; 'message-id:@mail.gmail.com': 0.29; 'problem': 0.29; 'class': 0.29; 'chris': 0.30; 'nov': 0.31; 'pm,': 0.31; 'thu,': 0.32; 'there': 0.33; 'all.': 0.34; 'properties': 0.36; 'thread': 0.36; 'variables': 0.36; 'but': 0.37; 'using': 0.37; 'received:google.com': 0.38; 'some': 0.38; 'received:209.85': 0.38; 'should': 0.39; 'subject:: ': 0.39; 'received:209': 0.40; 'subject': 0.61; '2011': 0.62; 'transfer': 0.72; 'sender:addr:chris': 0.84; 'url:rebertia': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=FHttK/zwr1U+5Ne1RDpTft8v80/FyrM/NliPDH7CFyw=; b=VGxzGD/M1vu5eICx9ug0sh7K2EgSKK5BL0eaQooulkCVFv6/v8KXU7J8HsacUS4Ycx ClrPQJIs0zzlrTm01VvNkHRE1zMEPSCpp7jdfvkTdHqFtKKsxPPsga8n1VlQ1ve+urpq j7548c35Soj+jY6i8YuVAedYwAsd0Oa78tMPE= |
| MIME-Version | 1.0 |
| Sender | chris@rebertia.com |
| In-Reply-To | <33183370.2460.1320988631657.JavaMail.geo-discussion-forums@yqcm23> |
| References | <32311626.67.1320984185425.JavaMail.geo-discussion-forums@yqjc16> <a18d022e-8f1c-46d6-9c5b-b0e6e74a4d3e@l23g2000pro.googlegroups.com> <33183370.2460.1320988631657.JavaMail.geo-discussion-forums@yqcm23> |
| Date | Thu, 10 Nov 2011 21:58:21 -0800 |
| X-Google-Sender-Auth | qD0Kuu01rJqmNrB3IQnGI1qQjE0 |
| Subject | Re: property decorator and inheritance |
| From | Chris Rebert <clp2@rebertia.com> |
| To | comp.lang.python@googlegroups.com |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| 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.2639.1320991104.27778.python-list@python.org> (permalink) |
| Lines | 23 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1320991104 news.xs4all.nl 6874 [2001:888:2000:d::a6]:58059 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:15586 |
Show key headers only | View raw
On Thu, Nov 10, 2011 at 9:17 PM, Laurent <laurent.payot@gmail.com> wrote:
> Yes using a separate class variable would transfer the problem to the class level. But adding 10 class variables if I have 10 properties would be ugly. Maybe I should reformulate the subject of this thread to "is there some python magic to pass parameters to decorator-declared properties ?"
Apparently, yes:
>>> class Foo(object):
... @property
... def bar(self, arg1='baz', arg2='qux'):
... return arg1, arg2
...
>>> Foo.bar.fget(Foo(), 'spam', 'eggs')
('spam', 'eggs')
>>>
Though I do not like this trick at all.
Cheers,
Chris
--
http://rebertia.com
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
property decorator and inheritance Laurent <laurent.payot@gmail.com> - 2011-11-10 20:03 -0800
Re: property decorator and inheritance alex23 <wuwei23@gmail.com> - 2011-11-10 20:43 -0800
Re: property decorator and inheritance Laurent <laurent.payot@gmail.com> - 2011-11-10 21:17 -0800
Re: property decorator and inheritance "OKB (not okblacke)" <brenNOSPAMbarn@NObrenSPAMbarn.net> - 2011-11-11 05:54 +0000
Re: property decorator and inheritance Chris Rebert <clp2@rebertia.com> - 2011-11-10 21:58 -0800
Re: property decorator and inheritance Laurent <laurent.payot@gmail.com> - 2011-11-11 01:41 -0800
Re: property decorator and inheritance Laurent <laurent.payot@gmail.com> - 2011-11-11 01:41 -0800
csiph-web