I think I can also confirm that setters **usually** not needed in Python. On 01.12.2015 16:48, Guido van Rossum wrote:
On Tue, Dec 1, 2015 at 1:01 AM, Andrew Barnert via Python-ideas <python-ideas@python.org <mailto:python-ideas@python.org>> wrote: [...]
And again, what's the benefit from this extra complexity? Unless you have a whole lot of decorators written that all need this exact same transformation, you're just abstracting out an arbitrary part of the logic that doesn't seem to fit any natural grain.
I'm assuming this recurring desire to improve on the property decorator is because there are several other languages where a compact way to declare getters and setters is part of the language syntax, and it usually takes the form of an indented block containing some functions.
But how important is this really? I did a quick count on a fairly big and complex code base I happened to have sitting around. It has 10x more classes than properties, and only a tiny fraction of those use the @x.setter notation. If that's the norm I'm not sure we need more. -- --Guido van Rossum (python.org/~guido <http://python.org/%7Eguido>)
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/