On Thu, Jul 02, 2020 at 11:04:40AM +0300, Serhiy Storchaka wrote:
02.07.20 10:12, Greg Ewing пише:
The @property.getter and @property.setter decorators are clever, but they have the disadvantage that you end up writing the name of the property no less than 5 times, all of which have to match.
5 times? How is it?
Perhaps Greg meant to say *up to* rather than "no less".
class MyClass: @property def spam(): ... @spam.setter def spam(self, value): ... @spam.deleter def spam(self): ...
That makes five by my count, however I hardly ever write a deleter so three is more common, and only occassionally a setter so one is most common :-)