Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note that if you don't have a paragraph prior to your code, use a paragraph that is just "::" in which case Sphinx will not render a colon.

Attributes, Parameters, Arguments, Return Values

Values

Function arguments, return values, and class properties are all All of these are marked up twice: once is the English description, next is the type. The exact prefixes will be detailed later when used.

...

  1. The type should be the lowest common denominator of the supported type. For example, if the type can be either a str or a unicode, then basestring should be specified.
  2. If the type is a class, use :class:`Name``Resource`.
  3. If multiple types are supported, separate them with a pipe (no spaces before or after the pipe).: int|bool|FunctionType
  4. List types should have the element type embedded in brackets.: [int], [int|:class:`Resource`]
  5. Dict types should have the key and value types separate by a "," (space after the comma) and embedded in curly brackets.: {basestring, :class:`Resource`}
  6. If None is a possible value, do not specify the type as None or NoneType. None values are not truly typed, but instead are treated specially everywhere in Python. In such cases, explain in the English description how None values are treated, if at all.
  7. Because Python is very dynamic, sometimes type does not matter much. In such cases do not use type object; instead omit the type information descriptor altogether.

Functions

In the class docstring add a section to document all arguments and return value. Arguments are documented with :param: and :type:. The return value is documented with :returns: and :rtype:. Complete example:

...