Friday, November 18, 2011

[Level 2] Pydoc, the document of Python.

In Java, we have javadoc to generate the document,
in Python, we have pydoc.
More info, please click here.


The sample of pydoc as the following:

The source code of testPyDoc.py
#!/usr/bin/python

"""
This is a sample module to generate pydoc
"""
__author__ =  'Stanley Huang'
__version__=  '1.0'

class PyDoc:
    """class docstrings"""
    def __init__ (self, user='guest', addr='Taipei'):
        """Set default attribute values only
        Keyword arguments:
        user -- name of user
        addr -- addr of user
        """
        self.user = user
        self.addr = addr
$ pydoc testPydoc
Help on module testPyDoc:

NAME
    testPyDoc - This is a sample module to generate pydoc

FILE
    /tmp/testPyDoc.py

CLASSES
    PyDoc
    
    class PyDoc
     |  class docstrings
     |  
     |  Methods defined here:
     |  
     |  __init__(self, user='guest', addr='Taipei')
     |      Set default attribute values only
     |      Keyword arguments:
     |      user -- name of user
     |      addr -- addr of user

DATA
    __author__ = 'Stanley Huang'
    __version__ = '1.0'

VERSION
    1.0

AUTHOR
    Stanley Huang
Wish this helps. regards, Stanley Huang