That's it. If you want to document a function or a class, you put a string just after the definition. For instance:
def foo():
"""This function does nothing."""
pass
But what about a module? How can I document what a file.py does?
From stackoverflow
Auron
-
It's easy, you just add a docstring at the top of the module.
From David Locke -
For the packages, you can document it in
__init__.py. For the modules, you can add a docstring simply in the module file.All the information is here: http://www.python.org/dev/peps/pep-0257/
From Grégoire Cachet -
You do it the exact same way. Put a string in as the first statement in the module.
From Chris Upchurch -
Ok, thank you for your quick answers :)
From Auron
0 comments:
Post a Comment