I'm a Perlhead trying to learn the Way of Python.Welcome to the light, my son.
I guess this is a rambling way to ask: are docstrings *it* as far
Python documentation goes? Or is there a second, more flexible
system?
You can define a decorator to inject the docstring; at least the
docstring will not come between the function line and the body.
Define the decorator like this:
def doc(docstring):
def inject_doc(function):
function.func_doc = docstring
return function
return inject_doc
And then you could do this:
@doc("This is the docstring.")
def some_function():
do_whatever()
I think most tools that use docstrings actually execute the module,
which means by the time the tool sees it the docstring will have been
assigned, though I'm not sure they all do.
Carl Banks