Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #109718

Re: what is wrong with this property setter

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 <mailman.101.1465465810.2306.python-list@python.org> (permalink)
References <bc685f14-106c-4d3f-38f9-262e05b896d7@shopzeus.com> <njb7oj$u9s$1@ger.gmane.org> <bb9a1f16-e88b-7936-2826-a6def0bdb309@shopzeus.com> <njbb80$lfv$1@ger.gmane.org> <897fc4dd-5018-b6ec-0723-be7322717e38@shopzeus.com> <njbe45$b7$1@ger.gmane.org>
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 <python-python-list@m.gmane.org>
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 <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>
X-Mailman-Original-Message-ID <njbe45$b7$1@ger.gmane.org>
X-Mailman-Original-References <bc685f14-106c-4d3f-38f9-262e05b896d7@shopzeus.com> <njb7oj$u9s$1@ger.gmane.org> <bb9a1f16-e88b-7936-2826-a6def0bdb309@shopzeus.com> <njbb80$lfv$1@ger.gmane.org> <897fc4dd-5018-b6ec-0723-be7322717e38@shopzeus.com>
Xref csiph.com comp.lang.python:109718

Show key headers only | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: what is wrong with this property setter Peter Otten <__peter__@web.de> - 2016-06-09 11:49 +0200

csiph-web