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

Commit bd96393

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 0516f81 commit bd96393

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
@@ -175,19 +175,18 @@ section.
175175
def f(cls, arg1, arg2, ...):
176176
...
177177

178-
The ``@classmethod`` form is a function :term:`decorator` -- see the description
179-
of function definitions in :ref:`function` for details.
178+
The ``@classmethod`` form is a function :term:`decorator` -- see
179+
:ref:`function` for details.
180180

181-
It can be called either on the class (such as ``C.f()``) or on an instance (such
181+
A class method can be called either on the class (such as ``C.f()``) or on an instance (such
182182
as ``C().f()``). The instance is ignored except for its class. If a class
183183
method is called for a derived class, the derived class object is passed as the
184184
implied first argument.
185185

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

189-
For more information on class methods, consult the documentation on the standard
190-
type hierarchy in :ref:`types`.
189+
For more information on class methods, see :ref:`types`.
191190

192191
.. versionadded:: 2.2
193192

@@ -1346,18 +1345,17 @@ section.
13461345
def f(arg1, arg2, ...):
13471346
...
13481347

1349-
The ``@staticmethod`` form is a function :term:`decorator` -- see the
1350-
description of function definitions in :ref:`function` for details.
1348+
The ``@staticmethod`` form is a function :term:`decorator` -- see
1349+
:ref:`function` for details.
13511350

1352-
It can be called either on the class (such as ``C.f()``) or on an instance (such
1353-
as ``C().f()``). The instance is ignored except for its class.
1351+
A static method can be called either on the class (such as ``C.f()``) or on an instance (such
1352+
as ``C().f()``).
13541353

13551354
Static methods in Python are similar to those found in Java or C++. Also see
13561355
:func:`classmethod` for a variant that is useful for creating alternate
13571356
class constructors.
13581357

1359-
For more information on static methods, consult the documentation on the
1360-
standard type hierarchy in :ref:`types`.
1358+
For more information on static methods, see :ref:`types`.
13611359

13621360
.. versionadded:: 2.2
13631361

0 commit comments

Comments
 (0)