On Thu, Dec 21, 2017 at 2:38 PM, Ian Kelly <ian.g.ke...@gmail.com> wrote: > On Wed, Dec 20, 2017 at 5:56 PM, Irv Kalb <i...@furrypants.com> wrote: >> 2) Alternatively, if the getter was going to use the @property decorator, >> then it would seem complimentary to have the decorator name for the >> associated setter function to have the word "property" in its also, >> something like @propertySetter. > > Perhaps this could have been done, but unlike the getter, the setter > is being defined on a property that now already exists. In this case > <name> has to be referenced somewhere within the decorator or else the > setter property will simply replace the getter property, rather than > augment and then replace it. > > I suppose what it boils down to is that there's no particular reason > to look up "property" again since the getter already declared that > this is a property.
It's more than that. It's actually not easy to locate something by its name while you're in process of setting it up. Consider: class Demo: @getter def foo(self): ... @setter def foo(self, value): ... Only one thing can be bound to Demo.foo, which means that that one thing has to be a property capable of calling on the getter and the setter. That means that when setter(foo) is called, it would need to locate the pre-existing "foo" property and augment it. That's actually pretty hard to do reliably (remember that there are many contexts in which this can be called). ChrisA -- https://mail.python.org/mailman/listinfo/python-list