Pydoc seem to ignore my comment
Bengt Richter
bokr at oz.net
Thu Nov 7 00:45:25 EST 2002
On Wed, 06 Nov 2002 22:31:31 GMT, "Thomas Weholt" <2002 at weholt.org> wrote:
>If I do something like :
>
>class Test:
> """
> Lots of docs.
> """
> def __init__(self):
> """
> Docs here too
> """
>
> def go(self):
> """
> More docs.
> """
>
>The doc-string just below the class-definition is included, all other
>doc-strings are ignored in the generated documentation. Why ????
>
>How must a declare my doc-string for them to be included??
>
I think pydoc is evolving. Do you have python 2.2.2? It produces:
[21:36] C:\pywk\junk>cat Test.py
class Test:
"""
Lots of docs.
"""
def __init__(self):
"""
Docs here too
"""
def go(self):
"""
More docs.
"""
[21:37] C:\pywk\junk>python D:\Python22\Lib\pydoc.py .\Test.py
Python Library Documentation: module Test
NAME
Test
FILE
c:\pywk\junk\test.py
CLASSES
Test
class Test
| Lots of docs.
|
| Methods defined here:
|
| __init__(self)
| Docs here too
|
| go(self)
| More docs.
|
| ----------------------------------------------------------------------
| Data and non-method functions defined here:
|
| __doc__ = '\n Lots of docs.\n '
|
| __module__ = 'Test'
DATA
__file__ = r'.\Test.py'
__name__ = 'Test'
Note the '.\' in the path spec. Apparently pydoc needs an explicit path to direct it
to a file in the current working directory.
BTW, you may be interested in additional formatting goodies described at
http://docutils.sourceforge.net/docs/rst/quickref.html
as well.
HTH.
Regards,
Bengt Richter
More information about the Python-list
mailing list