[Python-Dev] __doc__ string of builtin types

holger krekel pyth@devel.trillke.net
Thu, 16 May 2002 16:27:32 +0200


Patrick K. O'Brien wrote:
> [holger krekel]
> > as a workaround i have in the past used the check
> >
> >     getattr(type(obj),'__doc__','')==getattr(obj,'__doc__','')
> >
> > to determine if an object has 'real' documentation.
> > only doesn't work for the type-object because type(type)==type.
> 
> Thanks for the tip. In my particular case I'm actually using
> inspect.getdoc(). I suppose I could apply the same check to what it returns.
> Or someone might want to patch inspect.getdoc() if that would be easier in
> the short term. Just thought I'd mention that in case Ka-Ping Yee is
> following this thread.

i have just patched my inspect.py and pydoc.py to include the above
check. works fine! next time i update my cvs tree i submit
a patch.

regards,

    holger