Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Peter Otten <__peter__@web.de> Newsgroups: comp.lang.python Subject: Re: what is wrong with this property setter Date: Thu, 09 Jun 2016 11:49:57 +0200 Organization: None Lines: 24 Message-ID: References: <897fc4dd-5018-b6ec-0723-be7322717e38@shopzeus.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: news.uni-berlin.de 9t1eAy7VOIYbJLLrtSzr6QjRVxmI9tDEC16Tx1j3/Qnw== Return-Path: 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; 'works.': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; ':-)': 0.12; 'def': 0.13; '...)': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'received:t-ipconnect.de': 0.16; 'sugar': 0.16; 'syntactic': 0.16; 'wrote:': 0.16; 'basically': 0.18; 'creates': 0.18; '>>>': 0.20; 'logical': 0.22; 'header:User-Agent:1': 0.26; 'header:X -Complaints-To:1': 0.26; 'subject:what': 0.29; 'url:python': 0.33; 'could': 0.35; 'but': 0.36; 'url:org': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'method': 0.37; 'received:org': 0.37; 'skip:p 20': 0.38; 'to:addr:python.org': 0.40; 'subject:with': 0.40; 'received:de': 0.40; 'more.': 0.63; 'you.': 0.64; 'believe': 0.66; 'nagy': 0.84; 'url:cpython': 0.84; 'subject:this': 0.85 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: p57bd9048.dip0.t-ipconnect.de User-Agent: KNode/4.13.3 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <897fc4dd-5018-b6ec-0723-be7322717e38@shopzeus.com> Xref: csiph.com comp.lang.python:109718 Nagy László Zsolt wrote: > >>> Yes, and more. That property will also have a get method! Is it >>> intentional? >> It's a logical effect of how the setter() method works. The above is >> syntactic sugar for >> >> def set_parent(...): >> ... >> set_parent = parent.setter(set_parent) >> >> and parent.setter() creates a new property basically like this >> >> def setter(self, fset): >> return property(self.fget, fset, ...) > This I could not find, because property is a built-in. But I believe > you. :-) If you can read C: https://hg.python.org/cpython/file/tip/Objects/descrobject.c#l1183 https://hg.python.org/cpython/file/tip/Objects/descrobject.c#l1265