Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #109714 > unrolled thread
| Started by | Nagy László Zsolt <gandalf@shopzeus.com> |
|---|---|
| First post | 2016-06-09 11:15 +0200 |
| Last post | 2016-06-09 11:15 +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.
Re: what is wrong with this property setter Nagy László Zsolt <gandalf@shopzeus.com> - 2016-06-09 11:15 +0200
| From | Nagy László Zsolt <gandalf@shopzeus.com> |
|---|---|
| Date | 2016-06-09 11:15 +0200 |
| Subject | Re: what is wrong with this property setter |
| Message-ID | <mailman.98.1465463711.2306.python-list@python.org> |
>> 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. :-) > > Not very elegant, but I don't see a cleaner alternative. It can be used to define an alternative setter for the same property, but it is bad practice. Thank you for the clarification.
Back to top | Article view | comp.lang.python
csiph-web