summaryrefslogtreecommitdiffstats
path: root/Doc/documenting/markup.rst
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-07-29 16:01:11 (GMT)
committerGeorg Brandl <georg@python.org>2010-07-29 16:01:11 (GMT)
commit8a1caa2361b86baeadfe5343b0c74fe9dec2a4ce (patch)
treea61437b150df841a5de65b9bb92456e0e3b4139a /Doc/documenting/markup.rst
parentb0a4e3c1a747a1f40be0d0e4d2ab785b052673c2 (diff)
downloadcpython-8a1caa2361b86baeadfe5343b0c74fe9dec2a4ce.zip
cpython-8a1caa2361b86baeadfe5343b0c74fe9dec2a4ce.tar.gz
cpython-8a1caa2361b86baeadfe5343b0c74fe9dec2a4ce.tar.bz2
#6522: add a "decorator" directive to explicitly document decorators, and use it in a few places.
Diffstat (limited to 'Doc/documenting/markup.rst')
-rw-r--r--Doc/documenting/markup.rst32
1 files changed, 32 insertions, 0 deletions
diff --git a/Doc/documenting/markup.rst b/Doc/documenting/markup.rst
index 34a79d4..e48bb01 100644
--- a/Doc/documenting/markup.rst
+++ b/Doc/documenting/markup.rst
@@ -177,6 +177,34 @@ The directives are:
are modified), side effects, and possible exceptions. A small example may be
provided.
+.. describe:: decorator
+
+ Describes a decorator function. The signature should *not* represent the
+ signature of the actual function, but the usage as a decorator. For example,
+ given the functions
+
+ .. code-block:: python
+
+ def removename(func):
+ func.__name__ = ''
+ return func
+
+ def setnewname(name):
+ def decorator(func):
+ func.__name__ = name
+ return func
+ return decorator
+
+ the descriptions should look like this::
+
+ .. decorator:: removename
+
+ Remove name of the decorated function.
+
+ .. decorator:: setnewname(name)
+
+ Set name of the decorated function to *name*.
+
.. describe:: class
Describes a class. The signature can include parentheses with parameters
@@ -194,6 +222,10 @@ The directives are:
parameter. The description should include similar information to that
described for ``function``.
+.. describe:: decoratormethod
+
+ Same as ``decorator``, but for decorators that are methods.
+
.. describe:: opcode
Describes a Python :term:`bytecode` instruction.