A little utility app that creates template getters & setters for classes.
I just had to create a class with loads of getters & setters, and typing @property & @xxx.setter and def xxx…blah blah over and over and over again drove me to this
So, for example,
enter “CRM” for class name.
enter “name”, “address”, “contact” in the properties (without the quotes) , each on a new line.
Click “Go” and you’ll get this :
class CRM:
def __init__(self, **params):
self.name = params['name'] if 'name' in params else None
self.address = params['address'] if 'address' in params else None
self.contact = params['contact'] if 'contact' in params else None
@property
def name(self):
return self.name
@name.setter
def name(self,value):
self.name = value
@property
def address(self):
return self.address
@address.setter
def address(self,value):
self.address = value
@property
def contact(self):
return self.contact
@contact.setter
def contact(self,value):
self.contact = value
Just cut/paste the resulting code.
Hopefully it will be useful to someone. Source available if anyone gives a stuff …
(link updated)