Docstring

In programming, a docstring is a string literal specified in source code that is used, like a comment, to document a specific segment of code. Unlike conventional source code comments, or even specifically formatted comments like docblocks, docstrings are not stripped from the source tree when it is parsed and are retained throughout the runtime of the program. This allows the programmer to inspect these comments at run time, for instance as an interactive help system, or as metadata.

Languages that support docstrings include Python, Lisp, Elixir, Clojure,[1] Gherkin,[2] Julia[3] and Haskell.[4]

  1. ^ "Function definition with docstring in Clojure". Archived from the original on 2013-01-29. Retrieved 2017-09-20.
  2. ^ "Step Arguments - Doc Strings". Archived from the original on 2016-01-31. Retrieved 2016-06-22.
  3. ^ "Documentation — Julia Language 0.4.1 documentation". docs.julialang.org. Archived from the original on 2015-11-17.
  4. ^ "Docstrings".