Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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.

like image 965
Alex Gao Avatar asked Jan 28 '15 10:01

Alex Gao


1 Answers

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.

like image 117
Games Brainiac Avatar answered Sep 21 '22 14:09

Games Brainiac