Extracting documentation for user relevant functions only?

A

Anton81

Hi,

I've written a python script and added short docstrings. Now I'd like to
create a short overview of commands the user can use. However I don't want
the internal stuff that I also commented. Is there a way to create a fancy
documentation (e.g. pydoc) of certain functions only?

Anton
 
M

Micah Elliott

I've written a python script and added short docstrings. Now I'd
like to create a short overview of commands the user can use.
However I don't want the internal stuff that I also commented. Is
there a way to create a fancy documentation (e.g. pydoc) of certain
functions only?

You can use the leading underscores convention
<URL:http://docs.python.org/ref/id-classes.html> to "hide" the
intended invisible names. pydoc and epydoc both honor this...

$ cat foo.py
"""Foo test mod.
"""

def spam():
"Like ham."
pass

def _secret():
"Can't see this docstring."
pass

class Mustard(object):
__name1 = 1
_name2 = 2
name3 = 3


$ pydoc foo
Help on module foo:

NAME
foo - Foo test mod.

CLASSES
...
class Mustard(__builtin__.object)
...
| name3 = 3

FUNCTIONS
spam()
Like ham.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,271
Messages
2,571,357
Members
48,042
Latest member
DoraMcBrie

Latest Threads

Top