DataMining
DataMining

Reputation: 21

IPython and __doc__

I am using IPython, which is downloaded from "Enthought Python Distribution"

Under IPython / Python 2.7.3, when I type help(__doc__), the result is:

In  [26]: help(__doc__)
no Python documentation found for 'Automatically created module for IPython interactive environment'

What is the meaning of this result? IPython does not support?

Thanks!

Upvotes: 1

Views: 1240

Answers (1)

Yossarian
Yossarian

Reputation: 5471

As @Blender says, __doc__ is just a string, and is usually the help string for a given function or module. For example,

In [1]: numpy.__doc__
Out[1]: '\nNumPy\n=====\n\nProvides\n  1. An array object of arbitrary homogeneous items\n  2. Fast mathematical operations over arrays\n ...

is the help string for the numpy module. Calling help() on numpy essentially just prints out a nicely formatted version of this string:

Help on package numpy:

NAME
    numpy

FILE
    /usr/lib64/python2.6/site-packages/numpy/__init__.py

DESCRIPTION
    NumPy
    =====

    Provides
      1. An array object of arbitrary homogeneous items
      2. Fast mathematical operations over arrays
      ...

In IPython, the string __doc__ is just:

In [3]: __doc__
Out[3]: 'Automatically created module for IPython interactive environment'

Calling help(__doc__) then looks for __doc__.__doc__, which doesn't exist.

Upvotes: 2

Related Questions