May-02-2023, 02:23 PM
Just because something is legal doesn't make it right.
My point was for consistency in syntax. Since getters and setters apply only to properties it would make sense to have @getter and @setter decorators rather than @property. That would explicitly identify both the getter and setter and also eliminate the redundancy of having to specify the setter name in both the def and the decorator. Note that my suggestion could be implemented without breaking existing code. I thought clarity was one of the goals of Python.
My point was for consistency in syntax. Since getters and setters apply only to properties it would make sense to have @getter and @setter decorators rather than @property. That would explicitly identify both the getter and setter and also eliminate the redundancy of having to specify the setter name in both the def and the decorator. Note that my suggestion could be implemented without breaking existing code. I thought clarity was one of the goals of Python.