I have a simple descriptor to create a cached property as shown below.
class cproperty(object):
""" Property whose value is only calculated once and cached """
def __init__(self, func):
self._func = func
self.__doc__ = func.__doc__
def __get__(self, obj, type=None):
if obj is None:
return self
try:
return getattr(obj, '@%s' % self._func.func_name)
except AttributeError:
result = self._func(obj)
setattr(obj, '@%s' % self._func.func_name, result)
return result
The problem is that when I use the help() function on them, I don't get
the doc string from the function that is being wrapped. Instead, I get
the following:
hasEmployees = <StudioManager.utils.cproperty object at 0xf126f0>
What do I need to do to get the doc string of the wrapped function to
apper when using help()?
--
Kevin D. Smith
--
http://mail.python.org/mailman/listinfo/python-list