doc=""variable for passing the documentation string to the
property()function, I use a decorator that copies the doc-string from the decorated function and passes that to
property()explicitly. First, my decorator:
"""Function decorator for defining property attributes
The decorated function is expected to return a dictionary
containing one or more of the following pairs:
fget - function for getting attribute value
fset - function for setting attribute value
fdel - function for deleting attribute
This can be conveniently constructed by the locals() builtin
return property(doc=func.__doc__, **func())
An example of using this decorator to declare a managed attribute:
"The foo property attribute's doc-string"
def fset(self, value):
self._foo = value
The only subtle difference between my method and the property attribute definition method described in the Python Cookbook is that my version allows you to specify document the attribute using python's standard doc-string syntax.