Clarify use of signatures in python domain directives.

This commit is contained in:
Georg Brandl 2013-11-24 16:02:34 +01:00
parent 3db7c9a8d5
commit 1efbc75905

View File

@ -168,7 +168,7 @@ The following directives are provided for module and class contents:
Describes an exception class. The signature can, but need not include Describes an exception class. The signature can, but need not include
parentheses with constructor arguments. parentheses with constructor arguments.
.. rst:directive:: .. py:function:: name(signature) .. rst:directive:: .. py:function:: name(parameters)
Describes a module-level function. The signature should include the Describes a module-level function. The signature should include the
parameters, enclosing optional parameters in brackets. Default values can be parameters, enclosing optional parameters in brackets. Default values can be
@ -186,10 +186,11 @@ The following directives are provided for module and class contents:
are modified), side effects, and possible exceptions. A small example may be are modified), side effects, and possible exceptions. A small example may be
provided. provided.
.. rst:directive:: .. py:class:: name[(signature)] .. rst:directive:: .. py:class:: name
.. py:class:: name(parameters)
Describes a class. The signature can include parentheses with parameters Describes a class. The signature can optionally include parentheses with
which will be shown as the constructor arguments. See also parameters which will be shown as the constructor arguments. See also
:ref:`signatures`. :ref:`signatures`.
Methods and attributes belonging to the class should be placed in this Methods and attributes belonging to the class should be placed in this
@ -213,26 +214,26 @@ The following directives are provided for module and class contents:
information about the type of the data to be expected and whether it may be information about the type of the data to be expected and whether it may be
changed directly. changed directly.
.. rst:directive:: .. py:method:: name(signature) .. rst:directive:: .. py:method:: name(parameters)
Describes an object method. The parameters should not include the ``self`` Describes an object method. The parameters should not include the ``self``
parameter. The description should include similar information to that parameter. The description should include similar information to that
described for ``function``. See also :ref:`signatures`. described for ``function``. See also :ref:`signatures`.
.. rst:directive:: .. py:staticmethod:: name(signature) .. rst:directive:: .. py:staticmethod:: name(parameters)
Like :rst:dir:`py:method`, but indicates that the method is a static method. Like :rst:dir:`py:method`, but indicates that the method is a static method.
.. versionadded:: 0.4 .. versionadded:: 0.4
.. rst:directive:: .. py:classmethod:: name(signature) .. rst:directive:: .. py:classmethod:: name(parameters)
Like :rst:dir:`py:method`, but indicates that the method is a class method. Like :rst:dir:`py:method`, but indicates that the method is a class method.
.. versionadded:: 0.6 .. versionadded:: 0.6
.. rst:directive:: .. py:decorator:: name .. rst:directive:: .. py:decorator:: name
.. py:decorator:: name(signature) .. py:decorator:: name(parameters)
Describes a decorator function. The signature should *not* represent the Describes a decorator function. The signature should *not* represent the
signature of the actual function, but the usage as a decorator. For example, signature of the actual function, but the usage as a decorator. For example,