To install click the Add extension button. That's it.

The source code for the WIKI 2 extension is being checked by specialists of the Mozilla Foundation, Google, and Apple. You could also do it yourself at any point in time.

4,5
Kelly Slayton
Congratulations on this excellent venture… what a great idea!
Alexander Grigorievskiy
I use WIKI 2 every day and almost forgot how the original Wikipedia looks like.
Live Statistics
English Articles
Improved in 24 Hours
Added in 24 Hours
Languages
Recent
Show all languages
What we do. Every page goes through several hundred of perfecting techniques; in live mode. Quite the same Wikipedia. Just better.
.
Leo
Newton
Brights
Milds

From Wikipedia, the free encyclopedia

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]

YouTube Encyclopedic

  • 1/3
    Views:
    58 265
    169 818
    1 458 027
  • #6: Python Docstrings | Python Best Practices
  • Docstrings in Python | Python Tutorial - Day #29
  • APPRENDRE PYTHON DE A à Z

Transcription

Implementation examples

Elixir

Documentation is supported at language level, in the form of docstrings. Markdown is Elixir's de facto markup language of choice for use in docstrings:

def module MyModule do
  @moduledoc """
  Documentation for my module. With **formatting**.
  """

  @doc "Hello"
  def world do
    "World"
  end
end

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.[5] For instance:

 (defun foo () "hi there" nil)
 (documentation #'foo 'function) => "hi there"

Python

The common practice of documenting a code object at the head of its definition is captured by the addition of docstring syntax in the Python language.

The docstring for a Python code object (a module, class, or function) is the first statement of that code object, immediately following the definition (the 'def' or 'class' statement). The statement must be a bare string literal, not any other kind of expression. The docstring for the code object is available on that code object's __doc__ attribute and through the help function.

The following Python file shows the declaration of docstrings within a Python source file:

"""The module's docstring"""

class MyClass:
    """The class's docstring"""

    def my_method(self):
        """The method's docstring"""

def my_function():
    """The function's docstring"""

Assuming that the above code was saved as mymodule.py, the following is an interactive session showing how the docstrings may be accessed:

>>> import mymodule
>>> help(mymodule)
The module's docstring
>>> help(mymodule.MyClass)
The class's docstring
>>> help(mymodule.MyClass.my_method)
The method's docstring
>>> help(mymodule.my_function)
The function's docstring
>>>

Tools using docstrings

See also

References

  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".
  5. ^ CLHS: Standard Generic Function DOCUMENTATION...

External links

This page was last edited on 5 February 2024, at 20:49
Basis of this page is in Wikipedia. Text is available under the CC BY-SA 3.0 Unported License. Non-text media are available under their specified licenses. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc. WIKI 2 is an independent company and has no affiliation with Wikimedia Foundation.