From 8c8e4b45df29fc53771e9d205be831616859bde5 Mon Sep 17 00:00:00 2001 From: Daisuke Miyakawa Date: Sat, 7 Oct 2017 17:20:27 +0900 Subject: [PATCH 1/3] bpo-31567: Use decorator markup for staticmethod()/classmethod() --- Doc/library/functions.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 08093e61fe527d..b2281a2238761e 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -196,9 +196,9 @@ are always available. They are listed here in alphabetical order. base 16). :exc:`ValueError` will be raised if *i* is outside that range. -.. function:: classmethod(function) +.. decorator:: classmethod - Return a class method for *function*. + Transforms a method into a class method. A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this @@ -1398,9 +1398,9 @@ are always available. They are listed here in alphabetical order. For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`. -.. function:: staticmethod(function) +.. decorator:: staticmethod - Return a static method for *function*. + Transforms a method into a static method. A static method does not receive an implicit first argument. To declare a static method, use this idiom:: From 9b806c146712c7e05ffcf49138461e73df3e2d76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Wed, 11 Oct 2017 23:36:05 -0400 Subject: [PATCH 2/3] Cosmetic edit Use command form like in docstrings --- Doc/library/functions.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index b2281a2238761e..eed67301c04973 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -198,7 +198,7 @@ are always available. They are listed here in alphabetical order. .. decorator:: classmethod - Transforms a method into a class method. + Transform a method into a class method. A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this @@ -1400,7 +1400,7 @@ are always available. They are listed here in alphabetical order. .. decorator:: staticmethod - Transforms a method into a static method. + Transform a method into a static method. A static method does not receive an implicit first argument. To declare a static method, use this idiom:: From 59bc4a7025a37d5571adfdd6ed0f1c890d85faca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Wed, 11 Oct 2017 23:50:39 -0400 Subject: [PATCH 3/3] fix decorator markup --- Doc/library/abc.rst | 2 +- Doc/library/functools.rst | 4 ++-- Doc/library/test.rst | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/abc.rst b/Doc/library/abc.rst index 6001db32df49c3..9522dd62049138 100644 --- a/Doc/library/abc.rst +++ b/Doc/library/abc.rst @@ -278,7 +278,7 @@ The :mod:`abc` module also provides the following decorators: :func:`abstractmethod`, making this decorator redundant. -.. decorator:: abstractproperty(fget=None, fset=None, fdel=None, doc=None) +.. decorator:: abstractproperty A subclass of the built-in :func:`property`, indicating an abstract property. diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst index 9a8defee546bf3..28062c11890ed1 100644 --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -264,9 +264,9 @@ The :mod:`functools` module defines the following functions: return value -.. decorator:: singledispatch(default) +.. decorator:: singledispatch - Transforms a function into a :term:`single-dispatch ` :term:`generic function`. To define a generic function, decorate it with the ``@singledispatch`` diff --git a/Doc/library/test.rst b/Doc/library/test.rst index 33978e331b62fe..01ba1ec7062c98 100644 --- a/Doc/library/test.rst +++ b/Doc/library/test.rst @@ -440,7 +440,7 @@ The :mod:`test.support` module defines the following functions: otherwise. -.. decorator:: skip_unless_symlink() +.. decorator:: skip_unless_symlink A decorator for running tests that require support for symbolic links.