Consider the code:
class MyClass(object):
'''
Keep track of file and its path on disk
'''
def __init__(self):
self.file = None
self.path = None
I'd like to add doc-string to all properties. So, I could do something like (for file property):
class MyClass(object):
...
@property
def file(self):
'''
this is a doc-string for file property
'''
return self._file
@file.setter
def file(self, value):
self._file = value
@file.deleter
def file(self):
del self._file
However, it is tedious to write getter, setter and deleter methods for each property. In fact, these methods (as it is seen above) do the default job.
Is there an easy way to only add doc-string to properties?