Search code examples
pythonrestructuredtext

How to find all supported python, reStructuredText fieldnames?


I'm trying to learn more than the common :param myparam: Some description documentation style common in many python modules, but haven't been able to identify a full list of supported fieldnames. From examples, I've gathered param, raises, returns.

def my_method(self, someval):
    """Returns one plus the given value
    :param someval: an integer on which to operate
    :whatelseisthere:
    """
    return someval + 1

http://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html


Solution

  • The complete list of field names can be found here:

    • param, parameter, arg, argument, key, keyword: Description of a parameter.
    • type: Type of a parameter. Creates a link if possible.
    • raises, raise, except, exception: That (and when) a specific exception is raised.
    • var, ivar, cvar: Description of a variable.
    • vartype: Type of a variable. Creates a link if possible.
    • returns, return: Description of the return value.
    • rtype: Return type. Creates a link if possible.