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: 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> <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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Thu, Nov 10, 2011 at 9:17 PM, Laurent wrote: > Yes using a separate class variable would transfer the problem to the cla= ss level. But adding 10 class variables if I have 10 properties would be ug= ly. 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=3D'baz', arg2=3D'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