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.
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 propsd
snippet in PyCharm.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With