From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Mon, 25 Mar 2019 22:58:40 +0000 (-0700) Subject: bpo-34085: Improve wording on classmethod/staticmethod (GH-8228) X-Git-Tag: v2.7.17rc1~108 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bd96393cda54044d81054225dcfc1b26374589a8;p=thirdparty%2FPython%2Fcpython.git 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 --- diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 4386e603add1..8701f9d8ffb0 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -175,19 +175,18 @@ section. 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`. .. versionadded:: 2.2 @@ -1346,18 +1345,17 @@ section. 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 constructors. - 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`. .. versionadded:: 2.2