Re: Doc strings in descriptors

2009-05-03 Thread Gabriel Genellina
En Sun, 03 May 2009 20:58:19 -0300, Дамјан Георгиевски escribió: I have a simple descriptor to create a cached property as shown below. ... 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. ... What do I need to

Re: Doc strings in descriptors

2009-05-03 Thread Дамјан Георгиевски
> I have a simple descriptor to create a cached property as shown below. ... > 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. ... > What do I need to do to get the doc string of the wrapped function to > apper when

Re: Doc strings in descriptors

2009-05-03 Thread Steven D'Aprano
On Sat, 02 May 2009 23:36:26 -0500, Kevin D. Smith wrote: > I have a simple descriptor to create a cached property as shown below. ... > What do I need to do to get the doc string of the wrapped function to > apper when using help()? Call it on the class, not the instance: >>> class Test(object

Doc strings in descriptors

2009-05-02 Thread Kevin D . Smith
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):