[Python-Dev] docstrings, help(), and __name__

Guido van Rossum guido@python.org
Wed, 07 Aug 2002 20:18:49 -0400


> That appears to be correct. Interestingly, these methods seem to be treated
> differently from ordinary ones. My methods get shown like this:
> 
>    |  __init__ = __init__(...)
>    |      this is the __init__ function
>    |      its documentation has two lines.
> 
> 
> Where the 2nd instance of __init__ is given by the value of the __name__
> attribute, while built-in methods get shown as follows:
> 
>   >>> class X(object):
>   ...     def __init__(self): pass
>   ...
>   >>> help(X)
>   Help on class X in module __main__:
> 
>   class X(__builtin__.object)
>    |  Methods defined here:
>    |
>    |  __init__(self)
> 
> Does anyone know why the difference? Is it perhaps the missing 'im_class'
> attribute in my case? These are the sorts of things I want to know about...

Who knows.  As I said, pydoc is a mess of underdocumented
heuristics...

--Guido van Rossum (home page: http://www.python.org/~guido/)