Doc strings in descriptors

Gabriel Genellina gagsl-py2 at
Mon May 4 02:22:21 CEST 2009

En Sun, 03 May 2009 20:58:19 -0300, Дамјан Георгиевски <gdamjan at>  

>> 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 using help()?
> take a look at
> and possibly

That doesn't help. The descriptor *does* have its docstring copied from  
the function. But pydoc (the module behind the help system) doesn't handle  
the case - "normal" properties are handled specially, but a generic  
descriptor like that is not understood.

(and it's not so easy to fix - pydoc does a lot of things, all intermixed:  
it tries to discover all
methods and attributes, determine which are relevant, extract  
documentation from them, organize and clasify such documentation, generate  
HTML files/text files/present it to the user/run a webserver/invoke the  
pager... Too much for my taste, but I disgress...)

Gabriel Genellina

More information about the Python-list mailing list