Python – Pycharm (@property) and (@x.setter) autogeneration


I wonder whether there is some way of using Pycharm to automatically generate getter(@property) or setter for all my variables in a class.

If there is a way, can someone point it out ?

thanks! Actually I meant to generate (@property) and (@x.setter) automatically.

Best Solution

There isn't a way to do so. You can extract certain parts of code, but you cannot have pycharm generate getters and setters for you. There is no need either, since all variables are public, and the _var values, even though are treated as private variables can be altered as well.

EDIT (Change in question):

If you want to write less code when making getters and setters, then just use the props or the propsdsnippet in PyCharm.