0

I am using pydoc to create documentation. But it is only displaying the docstring for a class and for methods such as __init__. Is there any parameter to be passed to pydoc to create a documentation for each method of a class as well?

Example:

class myclass(some_other_class):
    """
    This is 'class' docstring.
    """

    def __init__(self):
       """
       This is docsctring for __init__ method.
       """
       pass

    def mymethod(self, some_parameter):
       """
       This is docstring for mymethod function.
       """
       pass

Now when I use pydoc on this code, I do not see "This is docstring for mymethod function." in the output generated.

exAres
  • 4,806
  • 16
  • 53
  • 95

1 Answers1

1

Your code looks perfectly fine, I put it in a script.py file, removed the "some_other_class" reference, and ran python -m pydoc -w script. It generated the following HTML:

class myclass
      This is 'class' docstring.

      Methods defined here:
          __init__(self)
            This is docsctring for __init__ method.
          mymethod(self, some_parameter)
            This is docstring for mymethod function.
Flavian Hautbois
  • 2,940
  • 6
  • 28
  • 45