Q re documentation Python style
pavlovevidence at gmail.com
Mon Jun 9 00:46:12 CEST 2008
On Jun 8, 5:17 pm, kj <so... at 987jk.com.invalid> wrote:
> 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
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:
function.func_doc = docstring
And then you could do this:
@doc("This is the docstring.")
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.
More information about the Python-list