469,328 Members | 1,316 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,328 developers. It's quick & easy.

Re: Q re documentation Python style

On Jun 8, 5:17 pm, kj <so...@987jk.com.invalidwrote:
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:
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():
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
Jun 27 '08 #1
0 1112

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Adam T. Gautier | last post: by
17 posts views Thread by Bart Nessux | last post: by
24 posts views Thread by Christopher J. Bottaro | last post: by
385 posts views Thread by Xah Lee | last post: by
62 posts views Thread by A.M. Kuchling | last post: by
6 posts views Thread by Tony Burrows | last post: by
4 posts views Thread by Fredrik Lundh | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Purva khokhar | last post: by
reply views Thread by haryvincent176 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.