← Back to DAGDA | Support | Source: https://github.com/python/cpython/commit/b23b08623a46cef841038ee32948020692ef1b35
Skip to content

Commit b23b086

Browse files
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 548cb60) Co-authored-by: Andre Delfino <adelfino@gmail.com>
1 parent cdd8d4d commit b23b086

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

‎Doc/library/functions.rst‎

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -210,19 +210,18 @@ are always available. They are listed here in alphabetical order.
210210
@classmethod
211211
def f(cls, arg1, arg2, ...): ...
212212

213-
The ``@classmethod`` form is a function :term:`decorator` -- see the description
214-
of function definitions in :ref:`function` for details.
213+
The ``@classmethod`` form is a function :term:`decorator` -- see
214+
:ref:`function` for details.
215215

216-
It can be called either on the class (such as ``C.f()``) or on an instance (such
216+
A class method can be called either on the class (such as ``C.f()``) or on an instance (such
217217
as ``C().f()``). The instance is ignored except for its class. If a class
218218
method is called for a derived class, the derived class object is passed as the
219219
implied first argument.
220220

221221
Class methods are different than C++ or Java static methods. If you want those,
222-
see :func:`staticmethod` in this section.
222+
see :func:`staticmethod`.
223223

224-
For more information on class methods, consult the documentation on the standard
225-
type hierarchy in :ref:`types`.
224+
For more information on class methods, see :ref:`types`.
226225

227226

228227
.. 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.
14451444
@staticmethod
14461445
def f(arg1, arg2, ...): ...
14471446

1448-
The ``@staticmethod`` form is a function :term:`decorator` -- see the
1449-
description of function definitions in :ref:`function` for details.
1447+
The ``@staticmethod`` form is a function :term:`decorator` -- see
1448+
:ref:`function` for details.
14501449

1451-
It can be called either on the class (such as ``C.f()``) or on an instance (such
1452-
as ``C().f()``). The instance is ignored except for its class.
1450+
A static method can be called either on the class (such as ``C.f()``) or on an instance (such
1451+
as ``C().f()``).
14531452

14541453
Static methods in Python are similar to those found in Java or C++. Also see
14551454
: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.
14641463
class C:
14651464
builtin_open = staticmethod(open)
14661465

1467-
For more information on static methods, consult the documentation on the
1468-
standard type hierarchy in :ref:`types`.
1466+
For more information on static methods, see :ref:`types`.
14691467

14701468

14711469
.. index::

0 commit comments

Comments
 (0)