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


Groups > comp.lang.python > #109718 > unrolled thread

Re: what is wrong with this property setter

Started byPeter Otten <__peter__@web.de>
First post2016-06-09 11:49 +0200
Last post2016-06-09 11:49 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#109718 — Re: what is wrong with this property setter

FromPeter Otten <__peter__@web.de>
Date2016-06-09 11:49 +0200
SubjectRe: what is wrong with this property setter
Message-ID<mailman.101.1465465810.2306.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web