On Sun, Jul 10, 2011 at 4:06 PM, Corey Richardson <kb1...@aim.com> wrote: > Excerpts from Carl Banks's message of Sun Jul 10 18:59:02 -0400 2011: >> print __doc__ >> > > Python 2.7.1 (r271:86832, Jul 8 2011, 22:48:46) > [GCC 4.4.5] on linux2 > Type "help", "copyright", "credits" or "license" for more information. >>>> def foo(): > ... "Docstring" > ... print __doc__ > ... >>>> foo() > None >>>> > > > What does yours do?
The question Carl's code was in answer to was, slightly paraphrased: "Is it possible to get a *module*'s docstring from within the module itself?" The question had nothing to do with *function* docstrings. The interactive interpreter environment also isn't quite a true module, so you can't give it a docstring or really test the relevant feature there. Try this instead: $ cat test.py """I am the docstring of the `test` module!""" print("This module's docstring is:", __doc__) $ python test.py This module's docstring is: I am the docstring of the `test` module! $ Cheers, Chris -- http://rebertia.com -- http://mail.python.org/mailman/listinfo/python-list