[Python-Dev] __doc__ string of builtin types

Thomas Heller thomas.heller@ion-tof.com
Thu, 2 May 2002 20:04:12 +0200

(I've filed a slightly confused bug report 550290.)

"spam".__doc__ is the same as str.__doc__,
it describes what the str(...) would do. Same for
42 . __doc__, and certainly many other objects.
While normally I don't care about the doc-string of
these objects, the output of pydoc looks strange:

>>> class O(object): 
...   "some text" 
>>> import pydoc 
>>> pydoc.help(O) 
Help on class O in module __main__: 

class O(__builtin__.object) 
| some text 
| Data and non-method functions defined here: 
| __dict__ = <dict-proxy object at 0x0080D410> 
| __doc__ = 'some text' 
| str(object) -> string 
| Return a nice string representation of the object. 
| If the argument is a string, the return value is the same object.