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 :-)


-- 
Steven
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/ZHPW7YN23FXEZHRJ5IJAYZ66VSMORFUU/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to