[Python-checkins] bpo-34085: Improve wording on classmethod/staticmethod (GH-8228)
Miss Islington (bot)
webhook-mailer at python.org
Mon Mar 25 19:00:06 EDT 2019
https://github.com/python/cpython/commit/b23b08623a46cef841038ee32948020692ef1b35
commit: b23b08623a46cef841038ee32948020692ef1b35
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2019-03-25T16:00:00-07:00
summary:
bpo-34085: Improve wording on classmethod/staticmethod (GH-8228)
* bpo-34085: Improve wording on classmethod/staticmethod
* Address comments from Éric
* Address comments from Éric
(cherry picked from commit 548cb6060ab9d5a66931ea2be4da08c2c72c9176)
Co-authored-by: Andre Delfino <adelfino at gmail.com>
files:
M Doc/library/functions.rst
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index 9326b8d0fe7d..2ed6fb3ba2b0 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -210,19 +210,18 @@ are always available. They are listed here in alphabetical order.
@classmethod
def f(cls, arg1, arg2, ...): ...
- The ``@classmethod`` form is a function :term:`decorator` -- see the description
- of function definitions in :ref:`function` for details.
+ The ``@classmethod`` form is a function :term:`decorator` -- see
+ :ref:`function` for details.
- It can be called either on the class (such as ``C.f()``) or on an instance (such
+ A class method can be called either on the class (such as ``C.f()``) or on an instance (such
as ``C().f()``). The instance is ignored except for its class. If a class
method is called for a derived class, the derived class object is passed as the
implied first argument.
Class methods are different than C++ or Java static methods. If you want those,
- see :func:`staticmethod` in this section.
+ see :func:`staticmethod`.
- For more information on class methods, consult the documentation on the standard
- type hierarchy in :ref:`types`.
+ For more information on class methods, see :ref:`types`.
.. function:: compile(source, filename, mode, flags=0, dont_inherit=False, optimize=-1)
@@ -1445,11 +1444,11 @@ are always available. They are listed here in alphabetical order.
@staticmethod
def f(arg1, arg2, ...): ...
- The ``@staticmethod`` form is a function :term:`decorator` -- see the
- description of function definitions in :ref:`function` for details.
+ The ``@staticmethod`` form is a function :term:`decorator` -- see
+ :ref:`function` for details.
- It can be called either on the class (such as ``C.f()``) or on an instance (such
- as ``C().f()``). The instance is ignored except for its class.
+ A static method can be called either on the class (such as ``C.f()``) or on an instance (such
+ as ``C().f()``).
Static methods in Python are similar to those found in Java or C++. Also see
:func:`classmethod` for a variant that is useful for creating alternate class
@@ -1464,8 +1463,7 @@ are always available. They are listed here in alphabetical order.
class C:
builtin_open = staticmethod(open)
- For more information on static methods, consult the documentation on the
- standard type hierarchy in :ref:`types`.
+ For more information on static methods, see :ref:`types`.
.. index::
More information about the Python-checkins
mailing list