Docstring
From Wikipedia, the free encyclopedia
In programming, a docstring is a string literal specified in source code, that is used for documenting a specific segment of code. Docstrings can also be used as comments to document the purpose of a piece of code. Unlike conventional source code comments, or even specifically formatted comments like Javadoc documentation, docstrings are not stripped from the source tree when it is parsed, but are retained throughout the runtime of the program. This allows the program to inspect these comments at run time, for instance as an interactive help system, or as metadata.
Among languages that support docstrings are Python and Lisp.
In Lisp, docstrings are known as documentation strings. The Common Lisp standard states that a particular implementation may choose to discard docstrings whenever they want, for whatever reason. When they are kept, docstrings may be viewed (and changed) using the DOCUMENTATION function.
[edit] Tools using docstrings
[edit] External links
- Python Docstrings at Epydoc's Sourceforge page
- Documentation in GNU Emacs Lisp
- Section from the doxygen documentation about Python docstrings